Beispiel #1
0
 public static User GetUserByLogin(string login)
 {
     using (var context = new FolderDbContext())
     {
         return(context.Users.FirstOrDefault(u => u.Login == login));
     }
 }
Beispiel #2
0
 public static bool UserExists(string login)
 {
     using (var context = new FolderDbContext())
     {
         return(context.Users.Any(u => u.Login == login));
     }
 }
Beispiel #3
0
 public static void AddFolderToUserHistory(Folder folder, Guid id)
 {
     using (var context = new FolderDbContext())
     {
         context.Folders.Add(folder);
         context.SaveChanges();
     }
 }
Beispiel #4
0
 public static void AddUser(User user)
 {
     using (var context = new FolderDbContext())
     {
         context.Users.Add(user);
         context.SaveChanges();
     }
 }
Beispiel #5
0
        public static List <Folder> GetFolderHistoryByUserId(Guid id)
        {
            using (var context = new FolderDbContext())
            {
                List <Folder> result = new List <Folder>();

                foreach (Folder f in context.Folders)
                {
                    if (f.UserId == id)
                    {
                        result.Add(f);
                    }
                }

                return(result);
            }
        }