public JsonResult Create(TM_NotifyType entity) { byte SymptomId = new NotifyTypeDao().Create(entity); entity.Id = SymptomId; if (SymptomId > 0) { return(Json(entity)); } else { return(NotifyError("Tạo")); } }
// Update public bool Update(TM_NotifyType entity) { try { var result = db.TM_NotifyType.Find(entity.Id); result.Name = entity.Name; result.Status = entity.Status; db.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public JsonResult Update(TM_NotifyType entity) { bool ok = new NotifyTypeDao().Update(entity); if (ok) { return(Json(new { isNewRecord = false, Id = entity.Id, Name = entity.Name, Status = entity.Status })); } else { return(NotifyError("Cập nhật"));; } }
// Create public byte Create(TM_NotifyType entity) { db.TM_NotifyType.Add(entity); db.SaveChanges(); return(entity.Id); }