예제 #1
0
 public void UpdateUser(User user)
 {
     var u = _entities.Users.FirstOrDefault(i => i.Id == user.Id);
     u.GroupId = user.GroupId;
     u.Name = user.Name;
     u.Password = user.Password;
     u.FirstName = user.FirstName;
     u.LastName = user.LastName;
     u.Gender = user.Gender;
     u.ReferUserId = user.ReferUserId;
     u.Status = user.Status;
     u.LastModifiedBy = user.LastModifiedBy;
     u.LastModifiedDate = DateTime.Now;
     _entities.SaveChanges();
 }
예제 #2
0
 /// <summary>
 /// Create a new User object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="groupId">Initial value of the GroupId property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="password">Initial value of the Password property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="gender">Initial value of the Gender property.</param>
 /// <param name="referUserId">Initial value of the ReferUserId property.</param>
 /// <param name="status">Initial value of the Status property.</param>
 /// <param name="lastModifiedBy">Initial value of the LastModifiedBy property.</param>
 /// <param name="lastModifiedDate">Initial value of the LastModifiedDate property.</param>
 public static User CreateUser(global::System.Int32 id, global::System.Int32 groupId, global::System.String name, global::System.String password, global::System.String firstName, global::System.String lastName, global::System.Boolean gender, global::System.Int32 referUserId, global::System.Int32 status, global::System.Int32 lastModifiedBy, global::System.DateTime lastModifiedDate)
 {
     User user = new User();
     user.Id = id;
     user.GroupId = groupId;
     user.Name = name;
     user.Password = password;
     user.FirstName = firstName;
     user.LastName = lastName;
     user.Gender = gender;
     user.ReferUserId = referUserId;
     user.Status = status;
     user.LastModifiedBy = lastModifiedBy;
     user.LastModifiedDate = lastModifiedDate;
     return user;
 }
예제 #3
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);
 }
예제 #4
0
 public void DeleteUser(User user)
 {
     var u = _entities.Users.FirstOrDefault(i => i.Id == user.Id);
     _entities.DeleteObject(u);
     _entities.SaveChanges();
 }