예제 #1
0
 public ActionResult AddSpu(AddSpuModel model, int id = 0, string addType = "",string q="")
 {
     if(addType == "name" || addType == "value")
     {
         if (addType == "value")
         {
             if (Request.QueryString["q"] != null)
             {
                 return Json(ItemProp.AddItemPropValueRequest(0,id , model.Name, int.Parse(model.Sort)));
             }
             else
             {
                 return Json(ItemProp.AddItemPropValueRequest(id, 0, model.Name, int.Parse(model.Sort)));
             }
         }
        return Json(ItemProp.AddItemPropNameRequest(model.Name, int.Parse(model.Sort), id));
     }
     else
     {
         return Content("未选择属性");
     }
 }
        public ActionResult EditBrand(AddSpuModel model,int id)
        {
            var r = ItemProp.UpdateItemPropValueRequest(model.Name, id, string.IsNullOrWhiteSpace(model.Sort) ? 0 : int.Parse(model.Sort),Request.Form["Display"].TryTo(0) == 1,model.Img);

            if (r)
            {
                TempData["success"] = "已成功修改“" + model.Name + "” 品牌";
                return RedirectToAction("Brand");
            }
            else
            {
                TempData["success"] = "未成功修改“" + model.Name + "” 品牌";
            }
            return View(new YunShop.Web.Models.AddSpuModel { 
                 Name=model.Name,
                 Sort=model.Sort,
                 Display=!(Request.Form["Display"].TryTo(0) == 1),
                 Img=model.Img,
                });
        }
예제 #3
0
 public ActionResult ExitSpu(AddSpuModel model, int id = 0, string addType = "")
 {
     if (id > 0 &&(addType == "name" || addType == "value"))
     {
         if (addType == "name")
         {
             if (ItemProp.GetItemPropNameRequest(id) != null)
             {
                 return Json(ItemProp.UpdateItemPropNameRequest(model.Name, id, int.Parse(model.Sort)));
             }
         }
         else
         {
             if (ItemProp.GetItemPropValueRequest(id) != null)
             {
                 return Json(ItemProp.UpdateItemPropValueRequest(model.Name, id, int.Parse(model.Sort)));
             }
         }
         return Content("未选择属性1");
     }
     return Content("未选择属性2");
 }
        public ActionResult AddBrand(AddSpuModel model)
        {

            var r = ItemProp.AddItemPropValueRequest(1370, 0, model.Name, string.IsNullOrWhiteSpace(model.Sort) ? 0 : int.Parse(model.Sort), Request.Form["Display"].TryTo(0) == 1);
            if(r>0)
            {
                TempData["success"] = "已成功添加“" + model.Name + "” 品牌";
                return RedirectToAction("Brand");
            }
            else
            {
                TempData["success"] = "未成功添加“" + model.Name + "” 品牌";
            }
            return View(new YunShop.Web.Models.AddSpuModel { 
                 Name=model.Name,
                 Sort=model.Sort,
                 Display=!(Request.Form["Display"].TryTo(0) == 1),
                });
        }