|
|
@ -196,5 +196,34 @@ namespace Sevomin.WebFrontend.Controllers |
|
|
|
DovominViewModel dvm = new DovominViewModel(u as Dovomin); |
|
|
|
return View("ProfileDovomin", dvm); |
|
|
|
} |
|
|
|
|
|
|
|
[Authorize] |
|
|
|
[HttpPost] |
|
|
|
public async Task<ActionResult> 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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |