public IActionResult Post([FromBody] UserPasswordDTO input) { var result = _userAccountService.CreateUserAndAccount(new UserDTO { Email = input.Email, FirstName = input.FirstName, LastName = input.LastName, PhoneNumber = input.PhoneNumber }, input.Password); if (result is UserSuccessResult) { //User and account successfully created. var user = (UserDTO)result.Item; //Return an OK and put the URL to the created user in the header. return(Created(Url.RouteUrl("GetUserById", new { id = result.Item.Id }), string.Format("User ID {0} created.", result.Item.Id))); } else { return(BadRequest(string.Format("Unable to create user. {0}", string.Join(",", result.Data.Cast <string>())))); } }