//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; }
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(); }
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 ""; }
/// <summary> /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUsers(User user) { base.AddObject("Users", user); }
/// <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; }