コード例 #1
0
 public Platform GetPlatformById(int?gekozenPlatform)
 {
     using (var db = new GameCollectionDBContainer())
     {
         return(db.PlatformSet.Find(gekozenPlatform));
     }
 }
コード例 #2
0
        public List <GameDetails> GetGamesPerConsole(int?id, int?collectionId)
        {
            List <GameDetails> games = new List <GameDetails>();

            using (var db = new GameCollectionDBContainer())
            {
                var query = (from game in db.GameSet.Include("ConsoleSoort")
                             where game.ConsoleSoort_Id == id
                             orderby game.Title
                             select game).ToList();
                foreach (var game in query)
                {
                    foreach (var gamecollection in game.GameCollectionUIs)
                    {
                        if (gamecollection.Collection_id == collectionId)
                        {
                            var gameD = new GameDetails();
                            gameD.Title       = game.Title;
                            gameD.ConsoleNaam = game.ConsoleSoort.ConsoleName;
                            gameD.Conditie    = gamecollection.Condition;
                            gameD.Version     = gamecollection.Version;
                            games.Add(gameD);
                        }
                    }
                }
                return(games);
            }
        }
コード例 #3
0
 public List <GameDetails> GetAllGamesFromSearch(string gameNaam, int userId)
 {
     using (var db = new GameCollectionDBContainer())
     {
         List <GameDetails> gevondenGamesVanUser = new List <GameDetails>();
         var query = (from game in db.GameSet.Include("ConsoleSoort")
                      where game.Title.Contains(gameNaam)
                      orderby game.Title
                      select game).ToList();
         foreach (var game in query)
         {
             foreach (var collection in game.GameCollectionUIs)
             {
                 if (collection.Collection_id == userId)
                 {
                     var gameD = new GameDetails();
                     gameD.Title       = game.Title;
                     gameD.ConsoleNaam = game.ConsoleSoort.ConsoleName;
                     gameD.Conditie    = collection.Condition;
                     gevondenGamesVanUser.Add(gameD);
                 }
             }
         }
         return(gevondenGamesVanUser);
     }
 }
コード例 #4
0
 public ConsoleSoort GetConsole(int?id)
 {
     using (var db = new GameCollectionDBContainer())
     {
         return(db.ConsoleSoortSet.Find(id));
     }
 }
コード例 #5
0
 public List <Platform> GetAllPlatformen()
 {
     using (var db = new GameCollectionDBContainer())
     {
         return(db.PlatformSet.OrderBy(p => p.PlatformName).ToList());
     }
 }
コード例 #6
0
 public void VoegGameToe(Game nieuw)
 {
     using (var db = new GameCollectionDBContainer())
     {
         db.GameSet.Add(nieuw);
         db.SaveChanges();
     }
 }
コード例 #7
0
 public void AddGameToCollection(GameCollectionUI gc)
 {
     using (var db = new GameCollectionDBContainer())
     {
         db.GameCollectionUIs.Add(gc);
         db.SaveChanges();
     }
 }
コード例 #8
0
 public Game getNewlyAddedGame(Game nieuweGame)
 {
     using (var db = new GameCollectionDBContainer())
     {
         var query = (from game in db.GameSet
                      where game.Title == nieuweGame.Title && game.ConsoleSoort_Id == nieuweGame.ConsoleSoort_Id
                      select game).FirstOrDefault();
         return(query);
     }
 }
コード例 #9
0
 public Game GetGameDetails(String gametitle, string consolenaam)
 {
     using (var db = new GameCollectionDBContainer())
     {
         var query = (from game in db.GameSet.Include("ConsoleSoort")
                      where game.Title == gametitle && game.ConsoleSoort.ConsoleName == consolenaam
                      select game).FirstOrDefault();
         return(query);
     }
 }
コード例 #10
0
 public Collection GetCollectionFromUser(User user)
 {
     using (var db = new GameCollectionDBContainer())
     {
         var query = (from collection in db.CollectionSet.Include("User")
                      where collection.User.Id == user.Id
                      select collection).FirstOrDefault();
         return(query);
     }
 }
コード例 #11
0
 public List <Game> GetAllGamesMetConsoleNaam()
 {
     using (var db = new GameCollectionDBContainer())
     {
         var query = (from game in db.GameSet.Include("ConsoleSoort")
                      orderby game.Title
                      select game).ToList();
         return(query);
     }
 }
コード例 #12
0
 public List <ConsoleSoort> GetAllConsoles()
 {
     using (var db = new GameCollectionDBContainer())
     {
         var query = from console in db.ConsoleSoortSet
                     orderby console.ConsoleName
                     select console;
         return(query.ToList());
     }
 }
コード例 #13
0
 public List <ConsoleSoort> GetAllConsolesFromPlatform(int?platformId)
 {
     using (var db = new GameCollectionDBContainer())
     {
         var query = from console in db.ConsoleSoortSet.Include("Platform")
                     where console.Platform.Id == platformId
                     orderby console.Id
                     select console;
         return(query.ToList());
     }
 }
コード例 #14
0
        public GameCollectionUI BestaatGameInCollection(Game nieuw, int userId)
        {
            using (var db = new GameCollectionDBContainer())
            {
                var query = (from gamecollection in db.GameCollectionUIs.Include("CollectionSet")
                             where gamecollection.Games_Id == nieuw.Id && gamecollection.CollectionSet.User_Id == userId
                             select gamecollection).FirstOrDefault();

                return(query);
            }
        }
コード例 #15
0
        public User GetUser(string naam, string paswoord)
        {
            using (var db = new GameCollectionDBContainer())
            {
                var query = (from user in db.UserSet
                             where user.UserName == naam & user.Password == paswoord
                             select user).FirstOrDefault();

                return(query);
            }
        }
コード例 #16
0
        public ConsoleSoort getConsoleId(string id)
        {
            var consoleId = int.Parse(id);

            using (var db = new GameCollectionDBContainer())
            {
                var query = (from console in db.ConsoleSoortSet.Include("Platform")
                             where console.Id == consoleId
                             select console).FirstOrDefault();
                return(query);
            }
        }
コード例 #17
0
        public GameCollectionUI GetGameCollection(User user)
        {
            using (var db = new GameCollectionDBContainer())
            {
                var query = (from gc in db.GameCollectionUIs.Include("CollectionSet")
                             where gc.CollectionSet.User_Id == user.Id
                             select gc).FirstOrDefault();


                return(query);
            }
        }
コード例 #18
0
 public Boolean BestaatGame(NewGame nieuw)
 {
     using (var db = new GameCollectionDBContainer())
     {
         var query = (from game in db.GameSet
                      where game.Title == nieuw.GameTitle && game.ConsoleSoort_Id == nieuw.Console
                      select game).FirstOrDefault();
         if (query != null)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
コード例 #19
0
        public int GetTotalAmountOfGamesOfUser(User user)
        {
            using (var db = new GameCollectionDBContainer())
            {
                if (user != null)
                {
                    var query = (from gc in db.GameCollectionUIs.Include("CollectionSet")
                                 where gc.CollectionSet.User_Id == user.Id
                                 select gc).ToList();

                    return(query.Count());
                }
                else
                {
                    return(0);
                }
            }
        }