public ActionResult AffiliatedCustomerList(int affiliateId, GridCommand command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageAffiliates))
                return AccessDeniedView();

            var affiliate = _affiliateService.GetAffiliateById(affiliateId);
            if (affiliate == null)
                throw new ArgumentException("No affiliate found with the specified id");

            var customers = _customerService.GetAllCustomers(affiliate.Id, command.Page - 1, command.PageSize);
            var model = new GridModel<AffiliateModel.AffiliatedCustomerModel>
            {
                Data = customers.Select(customer =>
                {
                    var customerModel = new AffiliateModel.AffiliatedCustomerModel()
					{
						Id = customer.Id,
						Email = customer.Email,
						Username = customer.Username,
						FullName = customer.GetFullName()
					};

                    return customerModel;
                }),
                Total = customers.TotalCount
            };

            return new JsonResult
            {
                Data = model
            };
        }
        public ActionResult AffiliatedCustomerList(int affiliateId, GridCommand command)
        {
            var model = new GridModel<AffiliateModel.AffiliatedCustomerModel>();

            if (_permissionService.Authorize(StandardPermissionProvider.ManageAffiliates))
            {
                var affiliate = _affiliateService.GetAffiliateById(affiliateId);
                var customers = _customerService.GetAllCustomers(affiliate.Id, command.Page - 1, command.PageSize);

                model.Data = customers.Select(customer =>
                {
                    var customerModel = new AffiliateModel.AffiliatedCustomerModel
                    {
                        Id = customer.Id,
                        Email = customer.Email,
                        Username = customer.Username,
                        FullName = customer.GetFullName()
                    };

                    return customerModel;
                });
                model.Total = customers.TotalCount;
            }
            else
            {
                model.Data = Enumerable.Empty<AffiliateModel.AffiliatedCustomerModel>();

                NotifyAccessDenied();
            }

            return new JsonResult
            {
                Data = model
            };
        }