Example #1
0
        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());
        }
Example #2
0
        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));
        }