public HttpResponseMessage GetAllCarsForRent()
 {
     try
     {
         List <CarForRentModel> allCarsForRent = carForRentRepository.GetAllCarsForRent();
         return(Request.CreateResponse(HttpStatusCode.OK, allCarsForRent));
     }
     catch (Exception ex)
     {
         Errors errors = ErrorsHelper.GetErrors(ex);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, errors));
     }
 }
 public IActionResult GetAllCarsForRent()
 {
     try
     {
         List <CarForRentModel> allCarsForRent = carForRentRepository.GetAllCarsForRent();
         return(Ok(allCarsForRent));
     }
     catch (Exception ex)
     {
         Errors errors = ErrorsHelper.GetErrors(ex);
         return(StatusCode(StatusCodes.Status500InternalServerError, errors));
     }
 }
 //[BasicAuthentication]
 //[AutorizeByRole(AutorizeByRoleAttribute.roles.Admin)]
 public HttpResponseMessage GetAllCarsForRent()
 {
     try
     {
         HttpResponseMessage hrm = new HttpResponseMessage(HttpStatusCode.OK)
         {
             Content = new StringContent(JsonConvert.SerializeObject(carForRentRepository.GetAllCarsForRent()))
         };
         return(hrm);
     }
     catch (Exception ex)
     {
         Errors errors          = ErrorsHelper.GetErrors(ex);
         HttpResponseMessage hr = new HttpResponseMessage(HttpStatusCode.InternalServerError)
         {
             Content = new StringContent(errors.ToString())
         };
         return(hr);
     }
 }