public async Task <ShelfSearchModel> PrepareShelfFormatSearchModel(ShelfSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } searchModel.SetGridPageSize(); return(await Task.FromResult(searchModel)); }
public async Task <ShelfListModel> PrepareShelfFormatListModel(ShelfSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } var shelfFormats = await _formatSettingService.GetAllShelfLocationFormatsAsync(); if (shelfFormats == null) { throw new ArgumentNullException(nameof(shelfFormats)); } var model = new ShelfListModel { Data = shelfFormats.PaginationByRequestModel(searchModel).Select(shelfFormat => { var shelfFormatsModel = shelfFormat.ToModel <ShelfModel>(); return(shelfFormatsModel); }), Total = shelfFormats.Count }; // sort if (searchModel.Sort != null && searchModel.Sort.Any()) { foreach (var s in searchModel.Sort) { model.Data = await model.Data.Sort(s.Field, s.Dir); } } // filter if (searchModel.Filter != null && searchModel.Filter.Filters != null && searchModel.Filter.Filters.Any()) { var filter = searchModel.Filter; model.Data = await model.Data.Filter(filter); model.Total = model.Data.Count(); } return(model); }
public FormatSettingContainerModel() { ListShelfFormat = new ShelfSearchModel(); ListBarcodeFormat = new BarcodeSearchModel(); }