예제 #1
0
 public static User GetUserByLogin(string login)
 {
     using (var context = new FolderDbContext())
     {
         return(context.Users.FirstOrDefault(u => u.Login == login));
     }
 }
예제 #2
0
 public static bool UserExists(string login)
 {
     using (var context = new FolderDbContext())
     {
         return(context.Users.Any(u => u.Login == login));
     }
 }
예제 #3
0
 public static void AddFolderToUserHistory(Folder folder, Guid id)
 {
     using (var context = new FolderDbContext())
     {
         context.Folders.Add(folder);
         context.SaveChanges();
     }
 }
예제 #4
0
 public static void AddUser(User user)
 {
     using (var context = new FolderDbContext())
     {
         context.Users.Add(user);
         context.SaveChanges();
     }
 }
예제 #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);
            }
        }