public object List() { List <Category> List = BllFactory.GetCategoryBLL().GetList(); var result = new GridResult <Category>(List); return(new JsonResult(result)); }
public object Show(int id) { Product product = BllFactory.GetProductBLL().GetProductById(id); if (product == null) { throw new MyMessageException("指定的ID值无效。不能找到对应的记录。"); } List <Category> categories = BllFactory.GetCategoryBLL().GetList(); ProductInfoModel data = new ProductInfoModel(categories, product); return(new PageResult("/Pages/Style1/Controls/ProductInfo.cshtml", data)); }
public object LoadModel(int?categoryId, int?page) { string papeUrl = this.GetTargetPageUrl("Products.aspx"); if (this.IsStyle2) { // Style2 风格下,页面不需要绑定数据。数据由JS通过AJAX方式获取 return(new PageResult(papeUrl, null)); } ProductsPageModel result = new ProductsPageModel(); result.Categories = BllFactory.GetCategoryBLL().GetList(); if (result.Categories.Count == 0) { return(new RedirectResult("/Pages/Categories.aspx")); } // 获取当前用户选择的商品分类ID ProductSearchInfo info = new ProductSearchInfo(); info.CategoryId = categoryId.HasValue ? categoryId.Value : 0; if (info.CategoryId == 0) { info.CategoryId = result.Categories[0].CategoryID; } info.PageIndex = page.HasValue ? page.Value - 1 : 0; info.PageSize = AppHelper.DefaultPageSize; result.ProductInfo = new ProductInfoModel( result.Categories, new Product { CategoryID = info.CategoryId }); result.PagingInfo = info; result.CurrentCategoryId = info.CategoryId; result.RequestUrlEncodeRawUrl = HttpUtility.UrlEncode(this.HttpContext.Request.RawUrl); // 加载商品列表 result.Products = BllFactory.GetProductBLL().SearchProduct(info); return(new PageResult(papeUrl, result)); }
public object ShowProductPicker(int?categoryId, string searchWord, int?page) { ProductSearchInfo info = new ProductSearchInfo(); info.CategoryId = categoryId.HasValue ? categoryId.Value : 0; info.SearchWord = searchWord ?? string.Empty; info.PageIndex = page.HasValue ? page.Value - 1 : 0; info.PageSize = AppHelper.DefaultPageSize; ProductPickerModel data = new ProductPickerModel(); data.SearchInfo = info; data.List = BllFactory.GetProductBLL().SearchProduct(info); data.CategoryList = BllFactory.GetCategoryBLL().GetList(); return(new PageResult("/Pages/Style1/Controls/ProductPicker.cshtml", data)); }
public object LoadModel() { // 根据用户选择的界面风格,计算实现要呈现的页面路径。 string papeUrl = this.GetTargetPageUrl("Categories.aspx"); if (this.IsStyle2) { // Style2 风格下,页面不需要绑定数据。数据由JS通过AJAX方式获取 return(new PageResult(papeUrl, null)); } // 为Style1 风格获取数据。 CategoriesPageModel result = new CategoriesPageModel(); result.List = BllFactory.GetCategoryBLL().GetList(); return(new PageResult(papeUrl, result)); }
public object GetList() { List <Category> List = BllFactory.GetCategoryBLL().GetList(); return(new JsonResult(List)); }
public void Update(Category category) { category.EnsureItemIsOK(); BllFactory.GetCategoryBLL().Update(category); }
public object Delete(int id) { BllFactory.GetCategoryBLL().Delete(id); return(new RedirectResult("/Pages/Categories.aspx")); }
public void Insert(Category category) { category.EnsureItemIsOK(); BllFactory.GetCategoryBLL().Insert(category); }