public ActionResult <DataResult <RegisterResponse> > Register([FromBody] RegisterRequest registerReq) { var response = new DataResult <RegisterResponse>(null) { Code = ResponseCode.BadRequest, Message = "unsuccessful" }; if (ModelState.IsValid) { var user = new User { EmailAddress = registerReq.EmailAddress, FirstName = registerReq.FirstName, LastName = registerReq.LastName, Password = registerReq.Password, CreateDate = DateTime.Now }; var result = _userDataRepo.Insert(user); if (result.Code == ResponseCode.OK) { response.Code = result.Code; response.Message = "User was created"; response.Result = new RegisterResponse { UserId = user.Id }; } else { response.Message = result?.Message; } } return(response); }
public ActionResult <DataResult <User> > SaveUser([FromBody] User user) { return(_userDataRepo.Insert(user)); }