/// <summary> /// 根据条件获取用户详情 /// </summary> /// <param name="model">The model.</param> /// <param name="command">The command.</param> /// <returns></returns> public ActionResult ListCustomer(CustomerListModel model, CustomerListPagingFilteringModel command) { if (command.PageNumber <= 0) { command.PageNumber = 1; } if (null == model) { model = new CustomerListModel(); } var roles = _customerService.GetAllCustomerRoles(); model.AvailableRoles = roles.ToSelectItems(); model.AvailableRoles.Insert(0, new SelectListItem() { Text = "请选择", Value = "0" }); model.AvailableActive = new List <SelectListItem>() { new SelectListItem() { Text = "请选择", Value = "0", Selected = true }, new SelectListItem() { Text = "激活", Value = "1" }, new SelectListItem() { Text = "停用", Value = "2" } }; bool?active = null; if (model.ActiveId == 1) { active = true; } else if (model.ActiveId == 2) { active = false; } var list = _customerService.GetAllCustormers(model.UserName, model.CustomerRoleId, active, model.BeginDate, model.EndDate, pageIndex: command.PageNumber - 1, pageSize: command.PageSize); model.Customers = list; model.PagingFilteringContext.LoadPagedList(list); return(View(model)); }
public CustomerListModel() { PagingFilteringContext=new CustomerListPagingFilteringModel(); AvailableRoles=new List<SelectListItem>(); }
public CustomerListModel() { PagingFilteringContext = new CustomerListPagingFilteringModel(); AvailableRoles = new List <SelectListItem>(); }
public ActionResult ListAjax(CustomerListModel model, CustomerListPagingFilteringModel command) { command.PageSize = 15; if (command.PageNumber <= 0) command.PageNumber = 1; //fiter customer var customers = _customerService.GetAllCustomers(pageIndex: command.PageNumber - 1, pageSize: command.PageSize); model.Customers = customers; model.PagingFilteringContext.LoadPagedList(customers); return PartialView(model); }