public async Task <JsonResult> GetList() { QueryAreaFilter filter = new QueryAreaFilter(); filter.limit = int.Parse(Request.Query["limit"]); filter.page = int.Parse(Request.Query["page"]); filter.ZipCode = Request.Query["zipCode"]; var result = await _areaAppService.GetAll(filter); OutputModel outputModel = new OutputModel(); outputModel.Data = result; return(new JsonResult(outputModel)); }
public async Task <Base.PagedResultDto <AreaDto> > GetAll(QueryAreaFilter filter) { var result = new Base.PagedResultDto <AreaDto>(); var areas = await _areaService.GetAll(new Service.AreaService.Dto.QueryAreaFilter() { PageCount = filter.PageCount, page = filter.page, limit = filter.limit, Sort = filter.Sort, ZipCode = filter.ZipCode, City = filter.City, State = filter.State, Street = filter.Street }); result.Items = _mapper.Map <List <AreaDto> >(areas.Items); result.TotalCount = areas.TotalCount; return(result); }
public async Task <PagedResultDto <Area> > GetAll(QueryAreaFilter filter) { var result = new PagedResultDto <Area>(); try { var query = await _areaRepository.GetAllByAsync(); query = query.Where(x => x.IsDel == 0); if (!string.IsNullOrWhiteSpace(filter.ZipCode)) { query = query.Where(x => x.ZipCode.Contains(filter.ZipCode)); } result.Items = query.OrderByDescending(x => x.CreateDate).Skip(filter.limit * (filter.page - 1)).Take(filter.limit).ToList(); result.TotalCount = query.Count(); } catch (Exception ex) { _logger.LogError("文章获取异常" + ex.ToString()); } return(result); }