/// <summary> /// Prepare paged customer role list model /// </summary> /// <param name="searchModel">Customer role search model</param> /// <returns>Customer role list model</returns> public virtual CustomerRoleListModel PrepareCustomerRoleListModel(CustomerRoleSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get customer roles var customerRoles = _customerService.GetAllCustomerRoles(true); //prepare grid model var model = new CustomerRoleListModel { Data = customerRoles.PaginationByRequestModel(searchModel).Select(role => { //fill in model values from the entity var customerRoleModel = role.ToModel <CustomerRoleModel>(); //fill in additional values (not existing in the entity) customerRoleModel.PurchasedWithProductName = _productService.GetProductById(role.PurchasedWithProductId)?.Name; return(customerRoleModel); }), Total = customerRoles.Count }; return(model); }
/// <summary> /// Prepare paged customer role list model /// </summary> /// <param name="searchModel">Customer role search model</param> /// <returns>Customer role list model</returns> public virtual CustomerRoleListModel PrepareCustomerRoleListModel(CustomerRoleSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get customer roles var customerRoles = _customerService.GetAllCustomerRoles(true); //prepare grid model var model = new CustomerRoleListModel { Data = customerRoles.PaginationByRequestModel(searchModel).Select(role => { //fill in model values from the entity var customerRoleModel = role.ToModel <CustomerRoleModel>(); return(customerRoleModel); }), Total = customerRoles.Count }; return(model); }
/// <summary> /// Prepare paged customer role list model /// </summary> /// <param name="searchModel">Customer role search model</param> /// <returns>Customer role list model</returns> public virtual CustomerRoleListModel PrepareCustomerRoleListModel(CustomerRoleSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get customer roles var customerRoles = _customerService.GetAllCustomerRoles(true).ToPagedList(searchModel); //prepare grid model var model = new CustomerRoleListModel().PrepareToGrid(searchModel, customerRoles, () => { return(customerRoles.Select(role => { //fill in model values from the entity var customerRoleModel = role.ToModel <CustomerRoleModel>(); //fill in additional values (not existing in the entity) customerRoleModel.PurchasedWithProductName = _productService.GetProductById(role.PurchasedWithProductId)?.Name; return customerRoleModel; })); }); return(model); }
public ActionResult List(DataSourceRequest command, CustomerRoleListModel model) { var datas = _roleService.GetAllRoles(keywords: model.Keywords, showHidden: true, pageIndex: command.Page - 1, pageSize: command.PageSize); var data = new DataSourceResult { Data = datas.Items, Total = datas.TotalCount }; return(AbpJson(data)); }
//Create,List,Edit,Delete (Get/Post)Methods #region Methods // GET: UserRoles public IActionResult Index() { //PageSize //var report = SharedData.UserRoleReport; //if (report != null) //{ // SharedData.RowCount = report.RowCount; // SharedData.ReportName = "UserRole"; //} //else //{ // SharedData.RowCount = 10; // SharedData.ReportName = "UserRole"; //} //form Name ViewBag.FormName = "User Roles "; //permissions if (SharedData.isAccessAdminPanelMenuAccessible == false) { return(AccessDeniedView()); } var model = new CustomerRoleListModel(); var customerRole = _customerService.GetAllCustomerRoles().Select(x => { var cmodel = new CustomerRoleModel() { Id = x.Id, Name = x.Name, Description = x.Description, Active = x.Active //ignore address for list view (performance optimization) }; return(cmodel); }) .ToList(); model.ListCustomerRole = customerRole; return(View(model)); }
public ActionResult List() { var model = new CustomerRoleListModel(); return(View(model)); }