public ActionResult Index() { StoreHomePageView storeHomePageView = new StoreHomePageView(); storeHomePageView.EmployeeView = GetEmployee(); #region Access Check bool hasPermission = GetEmployee().IsGuaranteed("Store_Read"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(storeHomePageView)); } #endregion storeHomePageView.StoreViews = this._storeService.GetStores().StoreViews; return(View(storeHomePageView)); }
public ActionResult Store_Read([DataSourceRequest] DataSourceRequest request) { GetStoresResponse storeResponse = new GetStoresResponse(); StoreHomePageView storeHomePageView = new StoreHomePageView(); storeHomePageView.EmployeeView = GetEmployee(); #region Access Check bool hasPermission = GetEmployee().IsGuaranteed("Store_Read"); if (!hasPermission) { var _result = new DataSourceResult() { Data = storeResponse.StoreViews, Total = storeResponse.Count }; ModelState.AddModelError("", "AccessDenied"); return(Json(_result)); } #endregion AjaxGetRequest getRequest = new AjaxGetRequest(); getRequest.PageSize = request.PageSize == 0 ? 10 : request.PageSize; getRequest.PageNumber = request.Page; storeResponse = this._storeService.GetStores(getRequest); storeHomePageView.StoreViews = storeResponse.StoreViews; storeHomePageView.Count = storeResponse.Count; var result = new DataSourceResult() { Data = storeResponse.StoreViews, Total = storeResponse.Count }; return(Json(result)); }