// // GET: /SE_MDBeautyCategoryProductConfig/ public ActionResult Index(int pageIndex = 1, int pageSize = 10, string categoryIds = "") { var data = SE_MDBeautyCategoryProductConfigBLL.Select(pageIndex, pageSize, categoryIds); int totalRecords = (data != null && data.Any()) ? data.FirstOrDefault().TotalCount : 0; ViewBag.totalRecords = totalRecords; ViewBag.totalPage = totalRecords % pageSize == 0 ? totalRecords / pageSize : (totalRecords / pageSize) + 1; return(View(data)); }
// // GET: /SE_MDBeautyCategoryProductConfig/Edit/5 public ActionResult Edit(int id = 0) { SE_MDBeautyCategoryProductConfigModel model = new SE_MDBeautyCategoryProductConfigModel(); model.RecommendCar = 4; //默认选项 if (id > 0) { model = SE_MDBeautyCategoryProductConfigBLL.Select(id); } ViewBag.ZTreeJsonForCategory = SE_MDBeautyCategoryConfigController.SE_MDBeautyCategoryTreeJson(model.CategoryIds, true); //ViewBag.ZTreeJsonForBrand = SE_MDBeautyBrandConfigController.SE_MDBeautyBrandTreeJson(model.Brands, true); ViewBag.ZTreeJsonForBrand = id > 0 ? SE_MDBeautyBrandTreeForCategoryIdJson(model.CategoryIds, model.Brands, true) : "[]"; return(View(model)); }
public ActionResult Save(SE_MDBeautyCategoryProductConfigModel model) { bool result = false; if (model != null) { try { var userName = HttpContext.User?.Identity?.Name; model.Brands = string.IsNullOrWhiteSpace(model.Brands) ? null : model.Brands; if (model.PId == 0) { var data = SyncProdcutLibrary(model, userName); logger.Info(data); result = SE_MDBeautyCategoryProductConfigBLL.BatchInsertOrUpdateSyncProdcutLibrary(data, model); } else { result = SE_MDBeautyCategoryProductConfigBLL.Update(model); model.ProdcutId = (SE_MDBeautyCategoryProductConfigBLL.Select(model.PId))?.ProdcutId; var propinfo = new Dictionary <string, object>() { ["Image_filename"] = model.Image_filename }; var updateResult = ProductService.UpdateProductByPropertyNames(model.ProdcutId, propinfo, userName); if (!updateResult) { logger.Error($"更新产品图片属性失败,product:{JsonConvert.SerializeObject(model)}"); } using (var client = new Tuhu.Service.Shop.CacheClient()) { client.UpdateBeautyProductDetailByPid(model.PId); } } } catch (Exception ex) { logger.Error(ex.Message, ex); } } return(RedirectToAction("Index", "SE_MDBeautyCategoryConfig")); }
// // GET: /SE_MDBeautyCategoryProductConfig/Edit/5 public ActionResult Edit(int id = 0) { SE_MDBeautyCategoryProductConfigModel model = new SE_MDBeautyCategoryProductConfigModel(); model.RecommendCar = 4; //默认选项 if (id > 0) { model = SE_MDBeautyCategoryProductConfigBLL.Select(id); if (!string.IsNullOrEmpty(model.ProdcutId)) { var imageUrl = (ProductService.GetProductBaseInfo(model.ProdcutId))?.Image; model.Image_filename = imageUrl; } } ViewBag.ZTreeJsonForCategory = SE_MDBeautyCategoryConfigController.SE_MDBeautyCategoryTreeJson(model.CategoryIds, true); //ViewBag.ZTreeJsonForBrand = SE_MDBeautyBrandConfigController.SE_MDBeautyBrandTreeJson(model.Brands, true); ViewBag.ZTreeJsonForBrand = id > 0 ? SE_MDBeautyBrandTreeForCategoryIdJson(model.CategoryIds, model.Brands, true) : "[]"; return(View(model)); }