public JsonResult delete(string id) { int ret = 0; MENU_BUS bus = new MENU_BUS(); MENU_OBJ obj = bus.GetMenuByCode(id); if (obj == null) { ret = -1; } if (ret >= 0) { ret = bus.Delete(obj); } bus.CloseConnection(); return(Json(new { sussess = ret }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Cập nhật một bản ghi được gửi lên từ phía client /// </summary> public JsonResult create(MENU_OBJ obj) { MENU_BUS bus = new MENU_BUS(); int ret = 0; var data = bus.GetMenuByCode(obj.MenuId); if (data == null) { ret = 0; obj.ID = Guid.NewGuid().ToString(); ret = bus.Insert(obj); } else { ret = -1; } bus.CloseConnection(); //some thing like that return(Json(new { sussess = ret }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Cập nhật một bản ghi được gửi lên từ phía client /// </summary> public JsonResult update(MENU_OBJ obj) { MENU_BUS bus = new MENU_BUS(); int ret = 0; var data = bus.GetMenuByCode(obj.MenuId); if (data != null) { ret = 0; obj.IUPDATEDTAE = DateTime.Now; ret = bus.Update(obj); } else { ret = -1; } bus.CloseConnection(); //some thing like that return(Json(new { sussess = ret }, JsonRequestBehavior.AllowGet)); }