Beispiel #1
0
        public IActionResult CreateNewRental([FromBody] RentalInputModel rental)
        {
            if (!ModelState.IsValid)
            {
                return(StatusCode(412, rental));
            }
            var id = _rentalService.CreateNewRental(rental);

            return(CreatedAtRoute("GetRentalById", new { id }, null));
        }
Beispiel #2
0
        public IActionResult CreateNewRental([FromBody] RentalInputModel body)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Model is not properly formatted."));
            }

            var entity = _rentalService.CreateNewRental(body);

            return(CreatedAtRoute("GetRentalById", new { id = entity.Id }, null));
        }