Example #1
0
        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));
            }
        }
Example #2
0
        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);
        }