public async Task <ActionResult> Index(string Name = "") { var Dtos = companyRepo.GetListDto(Name); if (Request.IsAjaxRequest()) { return(PartialView("_List", Dtos)); } return(View(Dtos)); }
public ActionResult AdminWelcome(AdminWelcomeSM sm, int page = 1, int pageSize = 40) { sm.Year = sm.Year.HasValue ? sm.Year.Value : 2017; var companyLimits = new List <CompanyCateLimitVM>(); //公司列表 var companys = companyRepo.GetListDto(); if (sm.CompanyId.HasValue) { companys = companys.Where(o => o.Id == sm.CompanyId).ToList(); } //分类列表 var cates = changeCateRepo.GetList(ViewHelp.GetRoleType(), CateDropType.Report, ViewHelp.GetCateIds()); if (sm.CateId.HasValue) { cates = cates.Where(o => o.Key == sm.CateId.ToString()).ToList(); } ViewBag.Cates = cates; foreach (var company in companys) { var companyLimit = new CompanyCateLimitVM(); companyLimit.CompanyId = company.Id; companyLimit.CompanyName = company.CompanyName; companyLimit.CompanyCateLimits = new List <CompanyCateLimitDTO>(); foreach (var cate in cates) { companyLimit.CompanyCateLimits.Add(companyLimitRepo.GetCompanyLimit(company.Id, cate.Key.ToInt(), sm.Year.Value)); } companyLimits.Add(companyLimit); } var vms = new PagedResult <CompanyCateLimitVM>() { CurrentPage = page, PageSize = pageSize, RowCount = companyLimits.Count, Results = companyLimits.Skip((page - 1) * pageSize).Take(pageSize).ToList() }; if (Request.IsAjaxRequest()) { return(PartialView("_List", vms)); } InitSearchSelect(); return(View(vms)); }