public async Task <IActionResult> List() { var storeId = _workContext.CurrentCustomer.StaffStoreId; var model = new CollectionListModel(); model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" }); foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId))) { model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() }); } return(View(model)); }
public async Task <IActionResult> List(DataSourceRequest command, CollectionListModel model) { if (await _groupService.IsStaff(_workContext.CurrentCustomer)) { model.SearchStoreId = _workContext.CurrentCustomer.StaffStoreId; } var collections = await _collectionService.GetAllCollections(model.SearchCollectionName, model.SearchStoreId, command.Page - 1, command.PageSize, true); var gridModel = new DataSourceResult { Data = collections.Select(x => x.ToModel()), Total = collections.TotalCount }; return(Json(gridModel)); }