public HttpResponseMessage GetVehCats() { var vehCats = new VehCats().VehCat_GetAll(); if (vehCats != null) { return(Request.CreateResponse(HttpStatusCode.OK, vehCats)); } return(Request.CreateResponse(HttpStatusCode.NoContent, vehCats)); }
public HttpResponseMessage PutVehCat(VehiCat vehCat) { try { if (ModelState.IsValid) { var result = new VehCats().VehCat_Update(vehCat); if (result != null || result != "") { return(Request.CreateResponse(HttpStatusCode.OK, result)); } } return(Request.CreateResponse(HttpStatusCode.NoContent)); } catch { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }
public HttpResponseMessage DeleteVehCat(int Pid) { var result = new VehCats().VehCat_GetById(Pid); if (result.PID == 0) { return(Request.CreateResponse(HttpStatusCode.NoContent, result)); } try { result.PID = new VehCats().VehCat_Delete(Pid); if (result.PID != 0) { return(Request.CreateResponse(HttpStatusCode.OK, result)); } return(Request.CreateResponse(HttpStatusCode.NoContent, result)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.BadRequest, result)); } }
public VehiCat GetVehCat(int?Pid) { var vehCat = new VehCats().VehCat_GetById(Pid); return(vehCat); }