//改 #region 3.0 修改实体 + int Modify(T model) /// <summary> /// 修改实体 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Modify(TEntity model) { DbEntityEntry entry = dbContext.Entry <TEntity>(model); entry.State = EntityState.Modified; return(dbContext.SaveChanges()); }
public ActionResult Edit([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.Entry(goodsInfo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.gShopId = new SelectList(db.ShopInfo, "sId", "sShopName", goodsInfo.gShopId); return(View(goodsInfo)); }