From 92ece3308d38606ff81f0932a20133b7cfc998be Mon Sep 17 00:00:00 2001 From: J Date: Sun, 30 Mar 2014 14:55:59 +0430 Subject: [PATCH] Profile avvalin http post --- .../AccountController.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Sevomin.WebFrontend.Controllers/AccountController.cs b/Sevomin.WebFrontend.Controllers/AccountController.cs index ac7e89b..3fc8baf 100644 --- a/Sevomin.WebFrontend.Controllers/AccountController.cs +++ b/Sevomin.WebFrontend.Controllers/AccountController.cs @@ -196,5 +196,34 @@ namespace Sevomin.WebFrontend.Controllers DovominViewModel dvm = new DovominViewModel(u as Dovomin); return View("ProfileDovomin", dvm); } + + [Authorize] + [HttpPost] + public async Task ProfileAvalin(string CompanyName, string NationalId, string RegisterId, + string Address, string CompanyPhoneNumber, string EMail) + { + User u = await UserManager.FindByNameAsync(User.Identity.Name); + try + { + if (u == null || !(u is Avalin)) + throw new InvalidOperationException("نوع کاربر صحیح نیست"); + Avalin avalin = (Avalin)u; + avalin.CompanyName = CompanyName; + avalin.NationalId = NationalId; + avalin.RegisterId = RegisterId; + avalin.Address = Address; + avalin.CompanyPhoneNumber = CompanyPhoneNumber; + avalin.Email = EMail; + + SevominDbContext.Current.SaveChanges(); + + } + catch (Exception) + { + + throw; + } + return View("ProfileAvalin", u as Avalin); + } } }