public ActionResult EditProduct(int pid = -1) { ProductInfo productInfo = AdminProducts.AdminGetProductById(pid); if (productInfo == null) { return(PromptView("商品不存在")); } CategoryInfo vCategoryInfo = AdminCategories.GetCategoryById(productInfo.CateId); string vCateName = ""; if (vCategoryInfo != null) { vCateName = vCategoryInfo.Name; } EditProductModel model = new EditProductModel(); model.PSN = productInfo.PSN; model.CateId = productInfo.CateId; model.CategoryName = vCateName; model.BrandId = productInfo.BrandId; model.ProductName = productInfo.Name; model.ShopPrice = productInfo.ShopPrice; model.MarketPrice = productInfo.MarketPrice; model.CostPrice = productInfo.CostPrice; model.State = productInfo.State; model.IsBest = productInfo.IsBest == 1 ? true : false; model.IsHot = productInfo.IsHot == 1 ? true : false; model.IsNew = productInfo.IsNew == 1 ? true : false; model.DisplayOrder = productInfo.DisplayOrder; model.Weight = productInfo.Weight; model.Description = productInfo.Description; model.BrandName = AdminBrands.GetBrandById(productInfo.BrandId).Name; //库存信息 ProductStockInfo productStockInfo = AdminProducts.GetProductStockByPid(pid); model.StockNumber = productStockInfo.Number; model.StockLimit = productStockInfo.Limit; //商品属性列表 List <ProductAttributeInfo> productAttributeList = Products.GetProductAttributeList(pid); //商品sku项列表 DataTable productSKUItemList = AdminProducts.GetProductSKUItemList(productInfo.Pid); ViewData["pid"] = productInfo.Pid; ViewData["cateId"] = productInfo.CateId; ViewData["categoryName"] = vCateName; ViewData["productAttributeList"] = productAttributeList; ViewData["productSKUItemList"] = productSKUItemList; ViewData["referer"] = ShopUtils.GetAdminRefererCookie(); return(View(model)); }
public ActionResult Edit(BrandModel model, int brandId = -1) { BrandInfo brandInfo = AdminBrands.GetBrandById(brandId); if (brandInfo == null) { return(PromptView("品牌不存在")); } int brandId2 = AdminBrands.GetBrandIdByName(model.BrandName); if (brandId2 > 0 && brandId2 != brandId) { ModelState.AddModelError("BrandName", "名称已经存在"); } if (ModelState.IsValid) { brandInfo.DisplayOrder = model.DisplayOrder; brandInfo.Name = model.BrandName; brandInfo.Logo = model.Logo; AdminBrands.UpdateBrand(brandInfo); AddAdminOperateLog("修改品牌", "修改品牌,品牌ID为:" + brandId); return(PromptView("品牌修改成功")); } Load(); return(View(model)); }
/// <summary> /// 展示优惠劵类型 /// </summary> /// <param name="couponTypeId">优惠劵类型id</param> public ActionResult ShowCouponType(int couponTypeId = -1) { CouponTypeInfo couponTypeInfo = AdminCoupons.AdminGetCouponTypeById(couponTypeId); if (couponTypeInfo == null) { return(PromptView("优惠劵类型不存在")); } CouponTypeModel model = new CouponTypeModel(); model.CouponTypeName = couponTypeInfo.Name; model.Money = couponTypeInfo.Money; model.Count = couponTypeInfo.Count; model.SendModel = couponTypeInfo.SendMode; model.GetModel = couponTypeInfo.GetMode; model.UseModel = couponTypeInfo.UseMode; model.UserRankLower = couponTypeInfo.UserRankLower; model.OrderAmountLower = couponTypeInfo.OrderAmountLower; model.LimitCateId = couponTypeInfo.LimitCateId; model.LimitBrandId = couponTypeInfo.LimitBrandId; model.LimitProduct = couponTypeInfo.LimitProduct; model.SendStartTime = couponTypeInfo.SendStartTime; model.SendEndTime = couponTypeInfo.SendEndTime; model.UseTimeType = couponTypeInfo.UseExpireTime > 0 ? 1 : 0; model.UseExpireTime = couponTypeInfo.UseExpireTime; model.UseStartTime = couponTypeInfo.UseStartTime; model.UseEndTime = couponTypeInfo.UseEndTime; model.State = couponTypeInfo.State; CategoryInfo categoryInfo = AdminCategories.GetCategoryById(model.LimitCateId); if (categoryInfo != null) { model.LimitCateName = categoryInfo.Name; } else { model.LimitCateName = "未限制分类"; } BrandInfo brandInfo = AdminBrands.GetBrandById(model.LimitBrandId); if (brandInfo != null) { model.LimitBrandName = brandInfo.Name; } else { model.LimitBrandName = "未限制品牌"; } LoadCouponType(); return(View(model)); }
public ActionResult Edit(int brandId = -1) { BrandInfo brandInfo = AdminBrands.GetBrandById(brandId); if (brandInfo == null) { return(PromptView("品牌不存在")); } BrandModel model = new BrandModel(); model.DisplayOrder = brandInfo.DisplayOrder; model.BrandName = brandInfo.Name; model.Logo = brandInfo.Logo; Load(); return(View(model)); }