コード例 #1
0
 public int EditDriverNWaySale(DriverNWaySaleModel model)
 {
     Hashtable HT = new Hashtable();
     HT.Add("DriverNWaySaleID", model.DriverNWaySaleID);
     HT.Add("DriverID", model.DriverID);
     HT.Add("MemberID", model.MemberID);
     HT.Add("Amount", model.Amount);
     HT.Add("SaleDate", model.SaleDate);
     HT.Add("InvoiceNo", model.InvoiceNo);
     int i = dbContext.ExecuteSP("udp_DriverNWaySale_ups", HT);
     return i;
 }
コード例 #2
0
 //insert customer
 public HttpResponseMessage Post(DriverNWaySaleModel nwaySale)
 {
     if (ModelState.IsValid)
     {
         db.AddDriverNWaySale(nwaySale);
         HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, nwaySale);
         response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = nwaySale.DriverNWaySaleID }));
         return response;
     }
     else
     {
         return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
     }
 }
コード例 #3
0
 //update customer
 public HttpResponseMessage Put(int id, DriverNWaySaleModel nwaySale)
 {
     if (!ModelState.IsValid)
     {
         return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
     }
     if (id != nwaySale.DriverNWaySaleID)
     {
         return Request.CreateResponse(HttpStatusCode.BadRequest);
     }
     try
     {
         db.EditDriverNWaySale(nwaySale);
     }
     catch (DbUpdateConcurrencyException ex)
     {
         return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
     }
     return Request.CreateResponse(HttpStatusCode.OK);
 }