Пример #1
0
 public static async Task <int> RemoveUser(UserAuth user)
 {
     using (var db = new UserAuthContext())
     {
         db.Users.Remove(user);
         return(await db.SaveChangesAsync());
     }
 }
Пример #2
0
 public static async Task <int> AddOrUpdateUser(UserAuth userAuth)
 {
     using (var db = new UserAuthContext())
     {
         var user = db.Users.FirstOrDefault(node => node.UserAuthId == userAuth.UserAuthId);
         if (user == null)
         {
             await db.Users.AddAsync(userAuth);
         }
         else
         {
             db.Users.Update(userAuth);
         }
         return(await db.SaveChangesAsync());
     }
 }