コード例 #1
0
 public void AddUser_Event(string userId, string content)
 {
     try
     {
         User_Event addModel = new User_Event()
         {
             Id = Guid.NewGuid(),
             Content = StringHelper.LimitLength(content, 500),
             CreateTime = DateTime.Now,
             GoodCount = 0,
             IsSeen = true,
             UserId = StringHelper.LimitLength(userId)
         };
         db.AddToUser_Events(addModel);
         db.SaveChanges();
     }
     catch
     { 
         throw new Exception("添加错误");
     }
 }
コード例 #2
0
 /// <summary>
 /// 用于向 User_Events EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToUser_Events(User_Event user_Event)
 {
     base.AddObject("User_Events", user_Event);
 }
コード例 #3
0
 /// <summary>
 /// 创建新的 User_Event 对象。
 /// </summary>
 /// <param name="id">Id 属性的初始值。</param>
 /// <param name="userId">UserId 属性的初始值。</param>
 /// <param name="content">Content 属性的初始值。</param>
 /// <param name="createTime">CreateTime 属性的初始值。</param>
 /// <param name="isSeen">IsSeen 属性的初始值。</param>
 /// <param name="goodCount">GoodCount 属性的初始值。</param>
 public static User_Event CreateUser_Event(global::System.Guid id, global::System.String userId, global::System.String content, global::System.DateTime createTime, global::System.Boolean isSeen, global::System.Int32 goodCount)
 {
     User_Event user_Event = new User_Event();
     user_Event.Id = id;
     user_Event.UserId = userId;
     user_Event.Content = content;
     user_Event.CreateTime = createTime;
     user_Event.IsSeen = isSeen;
     user_Event.GoodCount = goodCount;
     return user_Event;
 }