public ActionResult <Owner> Post([FromBody] Owner owner) { Owner result = null; if (owner.FirstName == null) { BadRequest("The owner has no firstname"); } else if (owner.LastName == null) { BadRequest("The owner has no lastname"); } else if (owner.Address == null) { BadRequest("The owner has no address"); } try { result = _ownerRepository.CreatOwner(owner); } catch (Exception e) { return(BadRequest(e.Message)); } if (result != null) { return(Ok("Owner with ID: " + owner.Id + " has been added!")); } else { return(BadRequest("Something went wrong!")); } }
public Owner NewOwner(Owner owner) { return(_ownerRepository.CreatOwner(owner)); }