public ActionResult Edit(int id) { var model = jlService.GetProduct(id); ProductModel vo = new ProductModel(); vo.Name = model.Name; vo.Picture = model.Picture; vo.MarketPrice = model.MarketPrice; vo.RetailPrice = model.RetailPrice; vo.SortIndex = model.SortIndex; vo.BriefIntro = model.BriefIntroduction; vo.Description = model.Description; vo.CategoryId = 0; vo.AddTime = model.AddTime; new ViewDataHelper(jlService).InitializeCategories(ViewData, 0, "categoryid"); return(View(vo)); }
// GET: Product public ActionResult Index(int id = 0) { // category PageReq pager = new PageReq(); var categoryData = jlService.ProductCategoryPage(pager); ViewBag.Categories = categoryData; if (id < 1) { var page = PageReq.Create(); var products = jlService.ProductPage(page); var p = products.Data.FirstOrDefault(); return(View(p)); } var product = jlService.GetProduct(id); return(View(product)); }