public virtual async Task <IActionResult> AffiliatedOrderListGrid(AffiliatedOrderSearchModel searchModel) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageAffiliates)) { return(await AccessDeniedDataTablesJson()); } //try to get an affiliate with the specified id var affiliate = await _affiliateService.GetAffiliateByIdAsync(searchModel.AffliateId) ?? throw new ArgumentException("No affiliate found with the specified id"); //prepare model var model = await _affiliateModelFactory.PrepareAffiliatedOrderListModelAsync(searchModel, affiliate); return(Json(model)); }