Beispiel #1
0
 public HttpResponseMessage add([FromBody] RM0008 value)
 {
     using (DB db = new DB())
     {
         result <RM0008> rel = new result <RM0008>();
         db.RM0008.Add(value);
         try
         {
             db.SaveChanges();
             rel.set("OK", value, "Thành công");
         }
         catch (Exception l)
         {
             rel.set("ERR", value, "Thất bại:" + l.Message);
         }
         return(rel.ToHttpResponseMessage());
     }
 }
Beispiel #2
0
 public HttpResponseMessage update([FromBody] RM0008 value)
 {
     using (DB db = new DB())
     {
         result <RM0008> rel   = new result <RM0008>();
         var             check = db.RM0008.SingleOrDefault(p => p.RM0008_ID == value.RM0008_ID);
         if (check != null)
         {
             check.ghiChu    = value.ghiChu;
             check.maDiaDiem = value.maDiaDiem;
             check.DiaDiem   = value.DiaDiem;
             try
             {
                 db.SaveChanges();
                 rel.set("OK", value, "Thành công");
             }
             catch (Exception l)
             {
                 rel.set("ERR", value, "Thất bại:" + l.Message);
             }
         }
         return(rel.ToHttpResponseMessage());
     }
 }