public async Task <IActionResult> AddUser([FromBody] UserViewModel user) { try { await SetAuthenticatedUser(); var newUser = await _userFacade.AddUserAsync(user, AuthenticatedUser); return(new JsonResult(newUser)); } catch (Exception e) { return(StatusCode(500, e)); } }
public async Task <IActionResult> AddUser([FromBody] AddUserRequest addUserRequest) { var addUserCommand = new AddUserCommand(addUserRequest.first_name, addUserRequest.last_name, addUserRequest.email, addUserRequest.gsm_no); var userEntity = await _userFacade.AddUserAsync(addUserCommand); var response = new AddUserResponse() { id = userEntity.ID, first_name = userEntity.FirstName, last_name = userEntity.LastName, email = userEntity.Email, gsm_no = userEntity.GsmNo }; return(Ok(response)); }
public async Task <IActionResult> AddUserAsync([FromBody] User user) { await _userFacade.AddUserAsync(user); return(Created(string.Empty, user)); }