Beispiel #1
0
 public void SaveBlockedUser(BlockedUser blockedUser)
 {
     if (!context.BlockedUsers.Where(n => n.UserId == blockedUser.UserId).Any())
     {
         context.BlockedUsers.Add(blockedUser);
     }
     context.SaveChanges();
 }
Beispiel #2
0
        public BlockedUser DeleteBlockedUser(string blockedUserId)
        {
            BlockedUser dbEntry = context.BlockedUsers
                                  .FirstOrDefault(p => p.UserId == blockedUserId);

            if (dbEntry != null)
            {
                context.BlockedUsers.Remove(dbEntry);
                context.SaveChanges();
            }

            return(dbEntry);
        }