public ActionResult AddNewRental(RentalCreateDTO rental) { try { var guid = rentalsService.AddNewRental(rental); string location = linkGenerator.GetPathByAction("GetRentalByID", "Rental", new { rentalID = guid }); return(Created(location, guid)); } catch (Exception ex) { // return StatusCode(500); return(StatusCode(400)); } }
public Guid AddNewRental(RentalCreateDTO rental) { return(rentalsRepository.AddNewRental(mapper.Map <Rental>(rental))); }