public async Task <ActionResult> CreateCustomer(CustomerEditView model) { if (ModelState.IsValid) { PaskolUser user = model.UserFromCustomerDetails(null); user.Status = UserStatus.Active; IdentityResult res = await CreateUserAsync(user, model.Password, new string[] { UserType.Customer.ToString() }); if (res.Succeeded) { return(RedirectToAction("Index")); } } return(View()); }
public async Task <ActionResult> EditCustomer(CustomerEditView EditedCustomer) { if (ModelState.IsValid) { PaskolUser user = await UserManager.FindByIdAsync(EditedCustomer.UserID); if (user != null) { // Save artist details EditedCustomer.UserFromCustomerDetails(user); if (await UpdateUserAsync(user, EditedCustomer.Password)) { return(RedirectToAction("index")); } } else { ModelState.AddModelError("", "User Not Found"); } } return(View(EditedCustomer)); }