public async Task <IActionResult> EditSingleItem(UserAuthUpdateModel model) { var statusMessage = await logicValidation.CheckUpdateUserAuthUpdateModelAsync(model.Login, model.PasswordOld); if (statusMessage.IsCompleted) { await logic.UpdateDataModelAsync(model); await logProvider.AddToLogAsync($"Updated user information (Id: {model.Login})."); return(RedirectToRoute(UserManagmentRouting.Index)); } else { return(View("CustomError", statusMessage)); } }
public async void UpdateUserData_AtInitializedDbTable_UpdatedUserDataEqualExpectedUserData() { // arrange var userData = GetUserData(); fixture.dbAuth.Add(userData); await fixture.dbAuth.SaveChangesAsync(); var expected = new UserData { Login = "******", RoleName = "bestAdmin" }; // act await logic.UpdateDataModelAsync(expected); // assert var actual = await fixture.dbAuth.UserData.FirstOrDefaultAsync(i => i.Login == userData.Login); Assert.Equal(expected.Login, actual.Login); Assert.Equal(expected.RoleName, actual.RoleName); }