public ActionResult <IEnumerable <UserResponseDto> > UpdateUsers([FromBody] IEnumerable <CreateUserDto> usersToBeUpdated) { List <UserResponseDto> response = new List <UserResponseDto>(); foreach (var user in usersToBeUpdated) { response.Add(_creator.UpdateUser(user)); } return(Ok(response)); }
public ActionResult <IEnumerable <UserResponseDto> > UpdateUsers([FromBody] IEnumerable <CreateUserDto> usersToBeUpdated) { List <UserResponseDto> response = new List <UserResponseDto>(); foreach (var user in usersToBeUpdated) { response.Add(_creator.UpdateUser(new CreateUserDto { Id = user.Id, Email = user.Email, Name = user.Name, StartDate = user.StartDate })); } return(Ok(response)); }
public void UserCreator_UpdateExistingUser_UserIsUpdated() { var context = new AlvTimeDbContextBuilder() .WithUsers() .CreateDbContext(); var storage = new UserStorage(context); var creator = new UserCreator(storage, new AlvHoursCalculator()); creator.UpdateUser(new CreateUserDto { Id = 1, Email = "*****@*****.**", Name = "SomeoneElse", StartDate = DateTime.UtcNow }); var user = context.User.FirstOrDefault(u => u.Id == 1); Assert.Equal("*****@*****.**", user.Email); Assert.Equal("SomeoneElse", user.Name); }