public object RoleMaintain(RoleMaintainModel model) { ResultPageData rs = new ResultPageData(); try { var List = dbContext.v_Jusoft_PcSysRoles.Where(p => true); if (!string.IsNullOrEmpty(model.SeachKey)) { List = List.Where(p => p.Name.Contains(model.SeachKey)); } var Data = List.Select(p => new { p.Id, p.Code, p.Name, }).OrderByDescending(p => p.Id).ToPagedList(model.PageIndex, model.PageSize); rs.Data = Data; rs.PageIndex = model.PageIndex; rs.PageCount = Data.PageCount; rs.HasNextPage = Data.HasNextPage; rs.TotalItemCount = Data.TotalItemCount; rs.Code = 0; rs.strResult = "ok"; return(Json(rs)); } catch (Exception ex) { rs.Code = 1001; rs.strResult = ex.Message; return(Json(rs)); } }
public IHttpActionResult RoleMaintain([FromUri] RoleMaintainModel model) { ResultPageData rs = new ResultPageData(); try { var List = dbContext.v_Jusoft_PcSysRoles.Where(p => true); if (!string.IsNullOrEmpty(model.SeachKey)) { List = List.Where(p => p.Name.Contains(model.SeachKey)); } var Data = List.Select(p => new { p.Id, p.Code, p.Name, }).OrderByDescending(p => p.Id).ToPagedList(model.PageIndex, model.PageSize); return(JsonResultHelper.JsonResult(Data)); } catch (Exception ex) { return(JsonResultHelper.JsonResult(1000, ex.Message)); } }