Exemplo n.º 1
0
 public int EditOfferApply(OfferApplyModel model)
 {
     Hashtable HT = new Hashtable();
     HT.Add("OfferApplyID", model.OfferApplyID);
     HT.Add("UserName", model.UserName);
     HT.Add("ApplyDate", model.ApplyDate);
     HT.Add("DriverFareOfferID", model.DriverFareOfferID);
     int i = dbContext.ExecuteSP("udp_OfferApply_ups", HT);
     return i;
 }
 //insert customer
 public HttpResponseMessage Post(OfferApplyModel offerApply)
 {
     if (ModelState.IsValid)
     {
         db.AddOfferApply(offerApply);
         HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, offerApply);
         response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = offerApply.OfferApplyID}));
         return response;
     }
     else
     {
         return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
     }
 }
 //update customer
 public HttpResponseMessage Put(int id, OfferApplyModel offerApply)
 {
     if (!ModelState.IsValid)
     {
         return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
     }
     if (id != offerApply.OfferApplyID)
     {
         return Request.CreateResponse(HttpStatusCode.BadRequest);
     }
     try
     {
         db.EditOfferApply(offerApply);
     }
     catch (DbUpdateConcurrencyException ex)
     {
         return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
     }
     return Request.CreateResponse(HttpStatusCode.OK);
 }