public async Task <ActionResult> Index(SearchViewModel model) { await GetCategoriesDropdown(); await GetProvinceDropdown(); await GetLocationsDropdown(); //SearchViewModel model = new SearchViewModel(); //return SearchView(new SearchViewModel()) model.Stores = new List <StoreDto>(); var output = await _storeAppService.GetStores(null, false); model.Stores = output; //return Json(model); return(View(model)); }
public virtual async Task <JsonResult> Result() { try { SearchViewModel model = new SearchViewModel(); model.Stores = new List <StoreDto>(); var output = await _storeAppService.GetStores(null, false); model.Stores = output; //return Json(model); //Redirect(") //return (model); // return RedirectToAction("Index", "Home"); return(Json(model, JsonRequestBehavior.AllowGet)); //return View("Index", model); } catch (Exception ex) { throw ex; } }
[DisableAuditing]//不添加日志 public PagedResultOutput <PageQueryDto> GetPageQuery(GetPageQueryInput input) { if (input.MaxResultCount <= 0) { input.MaxResultCount = SettingManager.GetSettingValue <int>(MySettingProvider.QuestionsDefaultPageSize); } var query = _pageRepository.GetAll() //TODO:根据传入的参数添加过滤条件 .WhereIf(input.Status != 0, m => m.Status == input.Status) .WhereIf(input.PageType != 0, m => m.PageType == input.PageType) .WhereIf(input.StoreId != 0, m => m.StoreId == input.StoreId) .WhereIf(!input.Keywords.IsNullOrWhiteSpace(), m => m.Name.Contains(input.Keywords)).OrderBy(input.Sorting); var totalCount = query.Count(); var list = query.PageBy(input).ToList(); List <PageQueryDto> Pagelist = new List <PageQueryDto>(); foreach (PageQueryDto item in list.MapTo <List <PageQueryDto> >()) { User user = _userManager.Users.FirstOrDefault(u => u.Id == item.CreatorUserId.Value); item.UserName = user.UserName; if (item.StoreId != null && item.StoreId != "0") { item.StoreId = _storeAppService.GetStores(Convert.ToInt32(item.StoreId)).Title; } item.PageTypeName = AppEnum.GetPageType(item.PageType); item.StatusName = AppEnum.GetPageStatus(item.Status); item.PagePositionName = AppEnum.GetPagePosition(item.PagePosition); Pagelist.Add(item); } return(new PagedResultOutput <PageQueryDto> { TotalCount = totalCount, Items = Pagelist }); }
public async Task <ActionResult> Index() { var output = await _appService.GetStores(null, false); return(View(output)); }