public void SaveData(string id, decimal LingShou, decimal YouHui, decimal PeiHuo, int KuCun, decimal YiShou) { GuiGeProduct_Info gg = DB.GuiGeProduct_Info.FindEntity(Convert.ToInt32(id)); gg.LingShou = LingShou; gg.YouHui = YouHui; gg.PeiHuo = PeiHuo; gg.KuCun = Convert.ToInt32(KuCun); gg.YiShou = Convert.ToInt32(YiShou); DB.GuiGeProduct_Info.Update(gg); }
public JsonResult addguige(decimal LingShou, decimal YouHui, decimal PeiHuo, int KuCun, decimal YiShou, string str, int productid, int SName) { JsonHelp json = new JsonHelp() { Msg = "增加数据失败" }; GuiGeProduct_Info gg = new GuiGeProduct_Info(); var entity = DB.ShopProduct.FindEntity(productid); if (entity == null) { json.Msg = "请先上传产品在选在规格"; return(Json(json)); } else { if (entity.CategoryID != SName) { json.Msg = "产品类型不一致,上传失败"; return(Json(json)); } } gg.LingShou = LingShou; gg.YouHui = YouHui; gg.PeiHuo = PeiHuo; gg.KuCun = Convert.ToInt32(KuCun); gg.YiShou = Convert.ToInt32(YiShou); gg.SName = DB.ShopProduct.GetCategoryId2(SName).ID; gg.ProductId = productid; string[] strlist = str.Split(','); string SComment = ""; for (int i = 0; i < strlist.Length; i++) { if (i == strlist.Length - 1) { SComment += strlist[i]; } else { SComment += strlist[i] + "_"; } } gg.SComment = SComment; if (DB.GuiGeProduct_Info.Any(a => a.ProductId == productid && a.SName == SName && a.SComment == SComment)) { json.Msg = "商品规格已存在"; return(Json(json)); } DB.GuiGeProduct_Info.Insert(gg); json.Msg = "商品规格添加成功"; json.IsSuccess = true; return(Json(json)); }