Esempio n. 1
0
        public IActionResult EditAdmin(string id)
        {
            var userFromDb = _userServices.GetUserById(id);

            if (userFromDb == null)
            {
                return(new NotFoundResult());
            }

            var model = new EditUserFromDbView()
            {
                Email       = userFromDb.Email,
                FirstName   = userFromDb.FirstName,
                Lastname    = userFromDb.LastName,
                Phonenumber = userFromDb.PhoneNumber
            };

            return(this.View(model));
        }
Esempio n. 2
0
        public IActionResult EditAdmin(EditUserFromDbView editUser)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            var user = new BookStoreUser()
            {
                Email           = editUser.Email,
                NormalizedEmail = editUser.Email,

                FirstName   = editUser.FirstName,
                LastName    = editUser.Lastname,
                PhoneNumber = editUser.Phonenumber
            };


            return(this.Redirect("/Users/AllUsers"));
        }