/// <summary> /// 用于向 FreeCard EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddToFreeCard(FreeCard freeCard) { base.AddObject("FreeCard", freeCard); }
public ActionResult AddCard(int cardType,int cardCount) { if (cardCount <= 0) return View(); var r = new Random(); for (int i = 0; i < cardCount; i++) { var c = new FreeCard(); c.Id = System.Guid.NewGuid(); c.CardType = cardType; c.CardNo = Ichari.Common.WebUtils.GenTradeNo(r); c.Password = GenCardPwd(c.Id.ToString(), c.CardNo); c.CreateTime = DateTime.Now; c.IsEnabled = true; _uow.FreeCardService.Add(c); } _uow.Commit(); return RedirectToAction("AddCard"); }
/// <summary> /// 创建新的 FreeCard 对象。 /// </summary> /// <param name="id">Id 属性的初始值。</param> /// <param name="cardType">CardType 属性的初始值。</param> /// <param name="createTime">CreateTime 属性的初始值。</param> /// <param name="isCatch">IsCatch 属性的初始值。</param> /// <param name="isDelivery">IsDelivery 属性的初始值。</param> /// <param name="isCost">IsCost 属性的初始值。</param> /// <param name="isEnabled">IsEnabled 属性的初始值。</param> public static FreeCard CreateFreeCard(global::System.Guid id, global::System.Int32 cardType, global::System.DateTime createTime, global::System.Boolean isCatch, global::System.Boolean isDelivery, global::System.Boolean isCost, global::System.Boolean isEnabled) { FreeCard freeCard = new FreeCard(); freeCard.Id = id; freeCard.CardType = cardType; freeCard.CreateTime = createTime; freeCard.IsCatch = isCatch; freeCard.IsDelivery = isDelivery; freeCard.IsCost = isCost; freeCard.IsEnabled = isEnabled; return freeCard; }