public ActionResult Index(int?pageIndex, int?pageSize, PermissionMap entity) { try { PermissionMapRepository ml = new PermissionMapRepository(); entity.IsDeleted = false; PagedList <PermissionMap> page = ml.Search(entity).GetPagedList(pageIndex ?? PageIndex, pageSize ?? PageSize, Order, By); if (page != null && page.TotalItemCount > 0) { foreach (var item in page) { if (item.Menu.ID == 0) { PermissionDataRepository pl = new PermissionDataRepository(); var plts = pl.Search().Where(b => b.PID == item.ID).ToList(); if (plts != null) { pl.Deletes(plts); } ml.Delete(item); } } page = ml.Search(entity).GetPagedList(pageIndex ?? PageIndex, pageSize ?? PageSize, Order, By); } IList <PermissionMap> objs = page; if (Request.IsAjaxRequest()) { return(PartialView("_Index", objs)); } return(View(objs)); } catch (Exception ex) { return(Content(ContentIcon.Error + "|" + ErrorWirter(RouteData, ex.Message))); } }
public ActionResult Index(int?pageIndex, int?pageSize, PermissionData entity) { try { PermissionDataRepository ml = new PermissionDataRepository(); entity.IsDeleted = false; PagedList <PermissionData> page = ml.Search(entity).GetPagedList(pageIndex ?? PageIndex, pageSize ?? PageSize, Order, By); IList <PermissionData> objs = page; if (Request.IsAjaxRequest()) { return(PartialView("_Index", objs)); } return(View(objs)); } catch (Exception ex) { return(Content(ContentIcon.Error + "|" + ErrorWirter(RouteData, ex.Message))); } }