Exemplo n.º 1
0
        public ActionResult Create([Bind(Include = "gId,gStationId,gSupplierId,gNumber,gName,gThumbImg1,gThumbImg2,gPicArray,gTagText,gTagValue1,gTagValue2,gTagValue3,gTagValue4,gTagValue5,gTagValue6,gTagValue7,gTagValue8,gTagValue9,gConentSummary,gContentDetail,gSlogan,gReminder,gDistribution,gSalesVolume,gBrand,gSourceArea,gStoreMode,gServiceMode,gKeys,gLabel,gDiscount,gWarnCount,gSafeDate,gShangjiaDate,gXiajiaDate,gAddDate,gState,gRemark,gFillerId,gFillDate,gIsCancel,gCancelId,gCancelDate,gContentDetailUrl,gShortPinyin,gStorage,gSeason,gShopId,gDaySalesAverage,gExternalNumber,gIsUseBean")] GoodsInfo goodsInfo)
        {
            if (ModelState.IsValid)
            {
                db.GoodsInfo.Add(goodsInfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.gShopId = new SelectList(db.ShopInfo, "sId", "sShopName", goodsInfo.gShopId);
            return(View(goodsInfo));
        }
Exemplo n.º 2
0
 //增
 #region 1.0 新增实体,返回受影响的行数 +  int Add(TEntity model)
 /// <summary>
 /// 1.0 新增实体,返回受影响的行数
 /// </summary>
 /// <param name="model"></param>
 /// <returns>返回受影响的行数</returns>
 public int Add(TEntity model)
 {
     entities.Add(model);
     //保存成功后,会将自增的id设置给model的主键属性,并返回受影响的行数。
     return(dbContext.SaveChanges());
 }