Ejemplo n.º 1
0
        public async Task <UserStoreListModel> PrepareUserStoreListModel(UserStoreSearchModel searchModel, Store store)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            if (store == null)
            {
                throw new ArgumentNullException(nameof(store));
            }

            var usersStore = await _storeService.GetUsersStore(storeId : store.P_BranchNo, pageIndex : searchModel.Page - 1,
                                                               pageSize : searchModel.PageSize);

            var model = new UserStoreListModel
            {
                Data = usersStore.Select(user =>
                {
                    var userStoreModel      = user.ToModel <UserStoreModel>();
                    userStoreModel.UserId   = user.Id;
                    userStoreModel.Email    = user.Email;
                    userStoreModel.Username = user.Username;
                    userStoreModel.Active   = user.Active;

                    return(userStoreModel);
                }),
                Total = usersStore.TotalCount
            };

            return(model);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> UserStoreList(UserStoreSearchModel searchModel)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageUserStore))
            {
                return(AccessDeniedKendoGridJson());
            }

            var store = _storeService.GetStoreById(searchModel.StoreId) ??
                        throw new ArgumentException("No store found with the specified id");

            var model = await _storeModelFactory.PrepareUserStoreListModel(searchModel, store);

            return(Json(model));
        }
Ejemplo n.º 3
0
        protected virtual Task <UserStoreSearchModel> PrepareUserStoreSearchModel(UserStoreSearchModel searchModel, Store store)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            if (store == null)
            {
                throw new ArgumentNullException(nameof(store));
            }

            searchModel.StoreId = store.P_BranchNo;

            searchModel.SetGridPageSize();

            return(Task.FromResult(searchModel));
        }