Exemplo n.º 1
0
 public IActionResult GetAllCars()
 {
     try
     {
         return(Ok(carsLogic.GetAllCars()));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
     }
 }
Exemplo n.º 2
0
        public HttpResponseMessage getAllCars()
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest,
                                                  ErrorsManager.GetErrors(ModelState)));
                }

                List <displayCarDTO> getAllCars = logic.GetAllCars();
                return(Request.CreateResponse(HttpStatusCode.OK, getAllCars));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(
                           HttpStatusCode.InternalServerError,
                           ErrorsManager.GetInnerMessage(ex)));
            }
        }
        //get all the cars that are ok to rent between startDate and endDate
        public IEnumerable GetAllCars(DateTime startDate, DateTime endDate)
        {
            CarsLogic cars = new CarsLogic();

            return(cars.GetAllCars(startDate, endDate));
        }