public HttpResponseMessage update([FromBody] RM0004 value) { using (DB db = new DB()) { result <RM0004> rel = new result <RM0004>(); var check = db.RM0004.SingleOrDefault(p => p.RM0004_ID == value.RM0004_ID); if (check != null) { check.ghiChu = value.ghiChu; check.maChuyenNganh = value.maChuyenNganh; check.tenChuyenNganh = value.tenChuyenNganh; 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] RM0004 value) { using (DB db = new DB()) { result <RM0004> rel = new result <RM0004>(); db.RM0004.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()); } }