Browse Source

Profile avvalin http post

confirmation-email
J 11 years ago
parent
commit
92ece3308d
1 changed files with 29 additions and 0 deletions
  1. +29
    -0
      Sevomin.WebFrontend.Controllers/AccountController.cs

+ 29
- 0
Sevomin.WebFrontend.Controllers/AccountController.cs View File

@ -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);
}
}
}

Loading…
Cancel
Save