Пример #1
0
        public async Task <IActionResult> Register([FromBody] ViewModel.User user)
        {
            user.Password = _tokenService.HashPassword(user, user.Password);

            var entity = _mapper.Map <Entities.User>(user);

            _userService.Create(entity);
            var state = await _userService.Commit();

            if (!state)
            {
                return(StatusCode(500, "A problem occurred while handling your request"));
            }

            var modelToReturn = _mapper.Map <ResponseDto.User>(entity);

            return(Ok(modelToReturn));
        }
Пример #2
0
 public async Task <IActionResult> Update(long id, [FromBody] ViewModel.User viewModel)
 {
     return(await base.Update(id, viewModel));
 }