// GET: api/CarTypes public HttpResponseMessage Get() { CarTypeModel[] CarTypesArry = CarTypeManager.GetAllCarTypes(); if (CarTypesArry == null) { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <CarTypeModel[]>(CarTypesArry, new JsonMediaTypeFormatter()) }); }
[Route("all")] // access link : http://localhost:53093/api/order/orders public HttpResponseMessage GetAllCarTypes() { using (logic = new CarTypeManager()) { try { List <CarTypeModel> CarTypes = logic.GetAllCarTypes(); return(Request.CreateResponse(HttpStatusCode.OK, CarTypes)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ExceptionHelper.GetInnerMessage(ex))); } } }