public ActionResult AjaxProductForClass(Guid id, int?page, int step = 1) { var pcls = _productSevice.GetProductClass(id); if (pcls == null) { return(HttpNotFound()); } int limit = 12; var finder = _productSevice.GetFinder().SeachProductClass(pcls.Id); var count = finder.Count(); var Paging = CalcPaging(limit, page, count); var model = new ClassProductViewModel { Step = step, ProductClass = pcls, Paging = Paging, ListProduct = finder.ToPage(limit, Paging.Page) }; return(PartialView("AjaxProductForClass", model)); }
// GET: Plugin public ActionResult ComputerBuilding() { var viewModel = new PluginComputerBuildingViewModel(); viewModel.ProductClass = new List <PluginProductClassViewModel>(); dynamic value = ThemesSetting.getValue("ComputerBuilding"); foreach (var it in value) { var id = new Guid((string)it.Value); var cat = _productSevice.GetProductClass(id); if (cat == null) { continue; } var a = new PluginProductClassViewModel { Id = id, Name = cat.Name.ToUpper() }; viewModel.ProductClass.Add(a); } return(View(viewModel)); }
public ActionResult Edit(Guid Id) { var productclass = _productSevice.GetProductClass(Id); if (productclass == null) { return(RedirectToAction("index")); } var model = new AdminEditProductClassViewModel { Id = productclass.Id, Colour = productclass.Colour, Description = productclass.Description, Image = productclass.Image, IsLocked = productclass.IsLocked, Name = productclass.Name, AllAttribute = GetProductClassAttribute(productclass) }; return(View(model)); }
private AdminMenuEditViewModel CreateEditMenuViewModel(Menu menu) { var viewModel = new AdminMenuEditViewModel { Id = menu.Id, ParentMenu = menu.Menu_Id, Name = menu.Name, Description = menu.Description, Colour = menu.Colour, iType = menu.iType, Image = menu.Image, SortOrder = menu.SortOrder, AllMenus = _menuService.GetBaseSelectListMenus(_menuService.GetMenusParenMenu(menu)), AllType = GetTypeLink(), AllPage = GetPageLink(), //AllCat = _categoryService.GetBaseSelectListCategories(_categoryService.GetAll()), AllCatNews = _categoryService.GetBaseSelectListCategories(_categoryService.GetList(false)), AllCatProduct = _categoryService.GetBaseSelectListCategories(_categoryService.GetList(true)), }; switch (menu.iType) { case 0: viewModel.Link = menu.Link; break; case 1: viewModel.LinkPage = menu.Link; break; //case 2: // viewModel.LinkCat = menu.Link; // break; case 6: viewModel.LinkCatNews = menu.Link; break; case 7: viewModel.LinkCatProduct = menu.Link; break; case 3: if (!menu.Link.IsNullEmpty()) { var a = _topicService.Get(new Guid(menu.Link)); if (a != null) { viewModel.LinkNews = menu.Link; viewModel.TitleNews = a.Name; } } break; case 4: if (!menu.Link.IsNullEmpty()) { var b = _productSevice.Get(new Guid(menu.Link)); if (b != null) { viewModel.LinkProduct = menu.Link; viewModel.TitleProduct = b.Name; } } break; case 5: if (!menu.Link.IsNullEmpty()) { var b = _productSevice.GetProductClass(new Guid(menu.Link)); if (b != null) { viewModel.LinkGroupProduct = menu.Link; viewModel.TitleGroupProduct = b.Name; } } break; } return(viewModel); }