public async Task <BarcodeSearchModel> PrepareBarcodeFormatSearchModel(BarcodeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } searchModel.SetGridPageSize(); return(await Task.FromResult(searchModel)); }
public async Task <BarcodeListModel> PrepareBarcodeFormatListModel(BarcodeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } var barcodeFormats = await _formatSettingService.GetAllBarcodeFormatsAsync(); var model = new BarcodeListModel { Data = barcodeFormats.Where(barcodeFormat => barcodeFormat.Format.Contains("Barcode")) .Select(barcodeFormat => { var barcodeFormatModel = barcodeFormat.ToModel <BarcodeModel>(); // barcodeFormatModel.Id = barcodeFormat.Id; return(barcodeFormatModel); }).OrderBy(x => x.Sequence), Total = barcodeFormats.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?.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(); }