public string TagList(int gameId)
        {
            string taglist = "";

            using (var db = new GameManagerContext())
            {
                var list = db.Games.Where(u => u.Id == gameId).
                           SelectMany(
                    g => g.Tags, (tag, game) =>
                    new GameTagDTO
                {
                    Tags = game.Name
                }).ToList();

                foreach (GameTagDTO game in list)
                {
                    taglist += game.Tags + ", ";
                }
                if (taglist.Length > 0)
                {
                    taglist = taglist.Substring(0, taglist.Length - 2);
                }
            }
            return(taglist);
        }
        public string GenreList(int gameId)
        {
            string genrelist = "";

            using (var db = new GameManagerContext()){
                var list = db.Games.Where(u => u.Id == gameId).
                           SelectMany(
                    g => g.Genre, (genre, game) =>
                    new GameGenreDTO
                {
                    Genres = game.Name
                }).ToList();

                foreach (GameGenreDTO game in list)
                {
                    genrelist += game.Genres + ", ";
                }
                if (genrelist.Length > 0)
                {
                    genrelist = genrelist.Substring(0, genrelist.Length - 2);
                }
            }
            return(genrelist);
        }
 protected RepositoryBase(GameManagerContext applicationDbContext)
 {
     _applicationDbContext = applicationDbContext;
 }
Beispiel #4
0
 public FriendRepository(GameManagerContext applicationDbContext)
     : base(applicationDbContext)
 {
 }
 public GameBorrowedRepository(GameManagerContext applicationDbContext)
     : base(applicationDbContext)
 {
 }