//获取组合表中的产品名称 public ActionResult GetChanPinName() { var temp = YXB_WinCanPinService.LoadEntities(x => x.Del == null).DefaultIfEmpty(); var TempKey = temp.GroupBy(x => x.TCanpinID).Where(g => g.Count() > 1); List <RetcTEMP> lr = new List <RetcTEMP>(); foreach (var a in TempKey) { YXB_WinCanPin iqt = temp.Where(x => x.TCanpinID == a.Key).FirstOrDefault(); RetcTEMP trp = new RetcTEMP(); trp.ID = iqt.T_ChanPinName.ID; trp.MyText = iqt.T_ChanPinName.MyTexts; lr.Add(trp); } return(Json(lr, JsonRequestBehavior.AllowGet)); }
//新增产品信息组合 public ActionResult addwinchanpin() { var cpnameid = Request["cpname"] == null ? 0 : int.Parse(Request["cpname"]); var cpxhid = Request["cpxh"] == null ? 0 : int.Parse(Request["cpxh"]); YXB_WinCanPin ywcp = new YXB_WinCanPin(); ywcp.TCanpinID = cpnameid; ywcp.TXingHao = cpxhid; var IsNotNUll = YXB_WinCanPinService.LoadEntities(x => x.TCanpinID == cpnameid && x.TXingHao == cpxhid).FirstOrDefault(); if (IsNotNUll != null) { return(Json("数据库中已存在要添加的信息,请核对信息!", JsonRequestBehavior.AllowGet)); } YXB_WinCanPinService.AddEntity(ywcp); return(Json("ok", JsonRequestBehavior.AllowGet)); }