Esempio n. 1
0
        public async Task <ActionResult> Update(string username, [FromBody] UserViewModel model)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(ModelStateErrorResponseError());
            }
            model.UserName = username;
            await _userManageAppService.UpdateUser(model);

            return(ResponsePutPatch());
        }
        public async Task <ActionResult <DefaultResponse <bool> > > Update([FromBody] UserViewModel model)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(Response(false));
            }
            await _userManageAppService.UpdateUser(model);

            return(Response(true));
        }
Esempio n. 3
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));
        }