Exemplo n.º 1
0
 public void AddUser_Item(string userId, string itemName, int typeId, int trashId, decimal itemAmount)
 {
     try
     {
         User_Item addModel = new User_Item()
         {
             Id = Guid.NewGuid(),
             UserId = StringHelper.LimitLength(userId),
             ItemName = StringHelper.LimitLength(itemName),
             TypeId = typeId,
             TrashId = trashId,
             ItemAmount = itemAmount,
             ModifyTime = DateTime.Now
         };
         db.AddToUser_Items(addModel);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// 用于向 User_Items EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToUser_Items(User_Item user_Item)
 {
     base.AddObject("User_Items", user_Item);
 }
 /// <summary>
 /// 创建新的 User_Item 对象。
 /// </summary>
 /// <param name="id">Id 属性的初始值。</param>
 /// <param name="userId">UserId 属性的初始值。</param>
 /// <param name="itemName">ItemName 属性的初始值。</param>
 /// <param name="typeId">TypeId 属性的初始值。</param>
 /// <param name="trashId">TrashId 属性的初始值。</param>
 /// <param name="itemAmount">ItemAmount 属性的初始值。</param>
 /// <param name="modifyTime">ModifyTime 属性的初始值。</param>
 public static User_Item CreateUser_Item(global::System.Guid id, global::System.String userId, global::System.String itemName, global::System.Int32 typeId, global::System.Int32 trashId, global::System.Decimal itemAmount, global::System.DateTime modifyTime)
 {
     User_Item user_Item = new User_Item();
     user_Item.Id = id;
     user_Item.UserId = userId;
     user_Item.ItemName = itemName;
     user_Item.TypeId = typeId;
     user_Item.TrashId = trashId;
     user_Item.ItemAmount = itemAmount;
     user_Item.ModifyTime = modifyTime;
     return user_Item;
 }