Exemplo n.º 1
0
        public async Task <ActionResult> EditPharmacist(PharmacistViewModel model)
        {
            if (ModelState.IsValid)
            {
                var AppMember = new AppMember {
                    UserName = model.Name, PhoneNumber = model.PhoneNumber,
                    Email    = model.Email, DateBirth = model.DateBirth, Address = model.Address,
                    Active   = model.Active, Id = model.Id
                };
                var userStore = new UserStore <AppMember>(Context);
                await userStore.UpdateAsync(AppMember);

                return(RedirectToAction("Pharmacists", "Admin"));
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> EditPharmacist(int id)
        {
            // initialize the view model
            var pharmacist_model = new PharmacistViewModel();

            // find the user by email
            var user = await UserManager.FindByIdAsync(id);

            if (user == null)
            {
                return(new EmptyResult());
            }

            pharmacist_model.Name        = toUpperCase(user.UserName);
            pharmacist_model.Email       = user.Email.ToLower();
            pharmacist_model.DateBirth   = user.DateBirth;
            pharmacist_model.Address     = user.Address;
            pharmacist_model.Active      = user.Active;
            pharmacist_model.PhoneNumber = user.PhoneNumber;
            pharmacist_model.Id          = user.Id;

            return(View(pharmacist_model));
        }