コード例 #1
0
ファイル: UserService.cs プロジェクト: prashanthganathe/JChat
 //public bool IncreaseBlockCount(int UId)
 //{
 //    var Usr = model.Users.Single(e => e.UId == UId);
 //    if (Usr != null)
 //    {
 //        Usr.BlockCount = Usr.BlockCount+1;
 //        return model.SaveChanges()>0?true:false;
 //    }
 //    return false;
 //}
 public int Update(User obj)
 {
     var Grp = model.Users.Single(e => e.UId == obj.UId);
     if (Grp != null)
     {
         Grp.UName = obj.UName;
         return model.SaveChanges();
     }
     return 0;
 }
コード例 #2
0
ファイル: UserService.cs プロジェクト: prashanthganathe/JChat
 public int UpdateUser(User obj)
 {
     var Usr = model.Users.Single(e => e.UId == obj.UId );
     if (Usr != null)
     {
         Usr.UName = obj.UName;
         Usr.Model = obj.Model;
         Usr.LastLogin = DateTime.Now;
     }
     return model.SaveChanges();
 }
コード例 #3
0
ファイル: UserService.cs プロジェクト: prashanthganathe/JChat
 public string Create(User obj)
 {
     var Grp = model.Users.Single(e => e.IP == obj.IP);
     if (Grp != null)
     {
         Grp.LastLogin = DateTime.Now;
         return Grp.UName;
     }
     obj.UName = GetUniqueUser();
     obj.IsActive = true;
     obj.LastLogin = DateTime.Now;
     model.Users.AddObject(obj);
     if (model.SaveChanges()>0)
         return obj.UName;
     else
         return "";
 }
コード例 #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUsers(User user)
 {
     base.AddObject("Users", user);
 }
コード例 #5
0
 /// <summary>
 /// Create a new User object.
 /// </summary>
 /// <param name="uId">Initial value of the UId property.</param>
 /// <param name="lastLogin">Initial value of the LastLogin property.</param>
 /// <param name="isActive">Initial value of the IsActive property.</param>
 public static User CreateUser(global::System.Int32 uId, global::System.DateTime lastLogin, global::System.Boolean isActive)
 {
     User user = new User();
     user.UId = uId;
     user.LastLogin = lastLogin;
     user.IsActive = isActive;
     return user;
 }