Example #1
0
 public User Save(User user)
 {
     int numEntr = -1;
     if (user.IdUser != 0)
     {
         User tempUser = this.mContext.Users.Where(c=>c.IdUser == user.IdUser).FirstOrDefault<User>();
         tempUser.Name = user.Name;
         tempUser.Login = user.Login;
         tempUser.PasswordHash = user.PasswordHash;
     }
     else
     {
         this.mContext.Users.Add(user);
     }
     numEntr = this.mContext.SaveChanges();
     if (numEntr > 0) return user;
     return null;
 }
Example #2
0
 public void Delete(User user)
 {
     int numEntr = -1;
     this.mContext.Users.Remove(user);
     numEntr = this.mContext.SaveChanges();
 }