コード例 #1
0
        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));
            }
        }
コード例 #2
0
 public Guid AddNewRental(RentalCreateDTO rental)
 {
     return(rentalsRepository.AddNewRental(mapper.Map <Rental>(rental)));
 }