public IHttpActionResult PutUser(int id, UserDataModel user) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != user.UserID) { return StatusCode(HttpStatusCode.BadRequest); } try { _user.UpdateUser(user); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostUser(UserDataModel user) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.CreateUser(user); return CreatedAtRoute("DefaultApi", new { id = user.UserID }, user); }
public UserDataModel CreateUser(UserDataModel oUserDataModel) { if (oUserDataModel != null) { UserDTO oUserDTO = new UserDTO(); oUserDTO = UserDataModelAssembler.ToDTO(oUserDataModel); if (oUserDTO != null) { oUsersBL.Create(oUserDTO); } } return oUserDataModel; }
public IHttpActionResult PostUser(UserDataModel user) { if (user == null) { return StatusCode(HttpStatusCode.BadRequest); } if (!ModelState.IsValid) { return BadRequest(ModelState); } _user.CreateUser(user); EmailService.SendPasswordResetEmail(user.UserName, user.UserName); return CreatedAtRoute("DefaultApi", new { id = user.UserID }, user); }
public UserDataModel CreateUser(UserDataModel userDataModel) { if (userDataModel != null) { UserDTO userDTO = new UserDTO(); UserAccountDTO userAccountDTO = new UserAccountDTO(); PhoneDTO oPhoneDTO = new PhoneDTO(); EmailDTO oEmailDTO = new EmailDTO(); AddressDTO oAddressDTO = new AddressDTO(); userDTO = UserDataModelAssembler.ToUserDTO(userDataModel); userAccountDTO = UserDataModelAssembler.ToUserAccountDTO(userDataModel); oPhoneDTO = UserDataModelAssembler.ToPhoneDTO(userDataModel); oEmailDTO = UserDataModelAssembler.ToEmailDTO(userDataModel); oAddressDTO = UserDataModelAssembler.ToAddressDTO(userDataModel); if (userDTO != null) { userDTO = usersBL.Create(userDTO); } if (userAccountDTO != null) { userAccountDTO = AccountBL.Create(userAccountDTO); } if (oPhoneDTO != null) { oPhoneDTO = oPhonesBL.Create(oPhoneDTO); } if (oEmailDTO != null) { oEmailsBL.Create(oEmailDTO); } if (oAddressDTO != null) { oAddressBL.Create(oAddressDTO); } } return userDataModel; }