public ActionResult Delete(string data) { if (isAdmin && accessDetail != null && (accessDetail.access["all"] || accessDetail.access["delete"])) { string[] separators = { "," }; string[] ids = data.Split(separators, StringSplitOptions.RemoveEmptyEntries); if (ids.Length == 0) { return(Json(new { success = false, message = "Chọn vị trí cần xóa!" })); } string st = new cms_BoxTin().Delete(ids); if (st == "true") { return(Json(new { success = true, message = "Thành công" })); } else { ModelState.AddModelError("", st); } } return(Json(new { success = false, message = "Don't have permission to delete " })); }
public ActionResult Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")] IEnumerable <cms_BoxTin> listrow) { ModelState.Clear(); try { if (accessDetail != null && (accessDetail.access["all"] || accessDetail.access["update"])) { string st = new cms_BoxTin().UpSert(listrow.ToList(), currentUser.name, "Update"); if (st == "true") { return(Json(new { success = true })); } else if (st == "Exist") { ModelState.AddModelError("", "Đã tồn tại!"); } else { ModelState.AddModelError("", "Thất bại"); } return(Json(listrow.ToDataSourceResult(request, ModelState))); } else { ModelState.AddModelError("", "Don't have permission to Create"); return(Json(new List <cms_BoxTin>().ToDataSourceResult(request, ModelState))); } } catch (Exception e) { return(Json(new { success = false, error = e.Message })); } }