Exemplo n.º 1
0
        public async Task <IActionResult> EditUser(EditUserFormData formData)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var result = await _context.EditUser(formData);

            if (result != null)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }
Exemplo n.º 2
0
        public async Task <object> EditUser(EditUserFormData formData)
        {
            var user = _userManager.Users.Where(u => u.Id == formData.Id).FirstOrDefault();

            if (user != null)
            {
                user.Email       = formData.Email;
                user.FirstName   = formData.FirstName;
                user.LastName    = formData.LastName;
                user.Address     = formData.Address;
                user.PhoneNumber = formData.PhoneNumber;
                return(await _userManager.UpdateAsync(user));
            }
            else
            {
                return(null);
            }
        }