Exemple #1
0
        public async Task Should_Update_User()
        {
            var command = UserViewModelFaker.GenerateUserViewModel().Generate();
            var result  = await _userAppService.Register(command);

            result.Should().BeTrue();

            var user = await _userManagerAppService.GetUserDetails(command.Username);

            user.Birthdate = DateTime.Now.Date.AddYears(-18);
            result         = await _userManagerAppService.UpdateUser(user);

            result.Should().BeTrue();

            user = await _userManagerAppService.GetUserDetails(command.Username);

            user.Birthdate.Should().Be(DateTime.Now.Date.AddYears(-18));
        }
Exemple #2
0
        public async Task <ActionResult <UserViewModel> > Details(string username)
        {
            var irs = await _userManageAppService.GetUserDetails(username);

            if (!User.IsInRole("Administrator") && !User.HasClaim(c => c.Type == "is4-manager") && _user.Username != username)
            {
                irs.Email       = irs.Email?.TruncateEmail();
                irs.UserName    = irs.UserName?.TruncateSensitiveInformation();
                irs.PhoneNumber = irs.PhoneNumber?.TruncateSensitiveInformation();
            }

            return(ResponseGet(irs));
        }
        public async Task <ActionResult> PartialUpdate([FromBody] JsonPatchDocument <UserViewModel> model)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(ModelStateErrorResponseError());
            }

            var actualUser = await _userAppService.GetUserDetails(_systemUser.Username);

            model.ApplyTo(actualUser);
            await _userAppService.UpdateProfile(actualUser);

            return(ResponsePutPatch());
        }
        public async Task <ActionResult <DefaultResponse <UserViewModel> > > Details(string username)
        {
            var irs = await _userManageAppService.GetUserDetails(username);

            return(Response(irs));
        }