public HttpResponseMessage update([FromBody] RM0003 value) { using (DB db = new DB()) { result <RM0003> rel = new result <RM0003>(); var check = db.RM0003.SingleOrDefault(p => p.RM0003_ID == value.RM0003_ID); if (check != null) { check.ghiChu = value.ghiChu; check.maBacDaoTao = value.maBacDaoTao; check.tenBacDaoTao = value.tenBacDaoTao; check.thuTu = value.thuTu; check.tinhTrang = value.tinhTrang; 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()); } }
public HttpResponseMessage add([FromBody] RM0003 value) { using (DB db = new DB()) { result <RM0003> rel = new result <RM0003>(); db.RM0003.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()); } }