public BaseApiResponse ListPage([FromBody] ListPageRequest request) { request.CheckNotNull(nameof(request)); var pageSize = 20; var thirdCurrencys = _thirdCurrencyQueryService.ThirdCurrencys(); var total = thirdCurrencys.Count(); //筛选 if (!request.Name.IsNullOrEmpty()) { thirdCurrencys = thirdCurrencys.Where(x => x.Name.Contains(request.Name)); } //分页 thirdCurrencys = thirdCurrencys.OrderByDescending(x => x.CreatedOn).Skip(pageSize * (request.Page - 1)).Take(pageSize); return(new ListResponse { Total = total, ThirdCurrencys = thirdCurrencys.Select(x => new ThirdCurrency { Id = x.Id, Name = x.Name, Icon = x.Icon, CompanyName = x.CompanyName, Conversion = x.Conversion, ImportedAmount = x.ImportedAmount, MaxImportAmount = x.MaxImportAmount, CreatedOn = x.CreatedOn.GetTimeSpan(), Remark = x.Remark, IsLocked = x.IsLocked }).ToList() }); }
public ThirdCurrencysResponse ThirdCurrencys() { var thirdCurrencys = _thirdCurrencyQueryService.ThirdCurrencys().Where(x => !x.IsLocked); return(new ThirdCurrencysResponse { ThirdCurrencys = thirdCurrencys.Select(x => new ThirdCurrency { Id = x.Id, Name = x.Name, CompanyName = x.CompanyName, Icon = x.Icon, Conversion = x.Conversion, ImportedAmount = x.ImportedAmount, MaxImportAmount = x.MaxImportAmount, Remark = x.Remark, IsLocked = x.IsLocked, CreatedOn = x.CreatedOn.GetTimeSpan() }).ToList() }); }