public IActionResult EndEditEmployee(UsersViewModel UsersViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View("EditEmployee", UsersViewModel));
            }

            if (UsersViewModel is null)
            {
                throw new ArgumentNullException(nameof(UsersViewModel));
            }

            User employee = new User()
            {
                Id        = UsersViewModel.Id,
                FirstName = UsersViewModel.FirstName,
                LastName  = UsersViewModel.LastName,
                Email     = UsersViewModel.Email,
                Age       = UsersViewModel.Age,
            };

            UsersDataService.Update(employee);
            return(RedirectToAction("Index"));
        }
示例#2
0
 public void UpdateUser(Users user)
 {
     _usersDataService.Update(user);
 }
示例#3
0
        public async Task <int> Update(UserDto userDto)
        {
            var entity = FactoryMapper.MapToEntity(userDto);

            return(await _userService.Update(entity));
        }