Esempio n. 1
0
        public Order GetOrder()
        {
            WebAssignmentDbContext db = new WebAssignmentDbContext();
            var order = db.Orders.SingleOrDefault(t => t.Id == OrderId);

            return(order);
        }
Esempio n. 2
0
        public Ref_Competition GetCompetition()
        {
            WebAssignmentDbContext db          = new WebAssignmentDbContext();
            Ref_Competition        competition = db.Ref_Competition.SingleOrDefault(m => m.Id == CompetitionId);

            return(competition);
        }
Esempio n. 3
0
        public Ticket_Game GetTicketGame()
        {
            WebAssignmentDbContext db = new WebAssignmentDbContext();
            var tg = db.Ticket_Game.SingleOrDefault(t => t.Id == Ticket_Game_Id);

            return(tg);
        }
Esempio n. 4
0
        public Game GetGame()
        {
            WebAssignmentDbContext db = new WebAssignmentDbContext();
            var game = GetTicketGames().ElementAt(0).GetGame();

            return(game);
        }
Esempio n. 5
0
        public Game GetGame()
        {
            WebAssignmentDbContext db = new WebAssignmentDbContext();
            var game = db.Games.SingleOrDefault(t => t.Id == GameId);

            return(game);
        }
Esempio n. 6
0
        public Ticket GetTicket()
        {
            WebAssignmentDbContext db = new WebAssignmentDbContext();
            var ticket = db.Tickets.SingleOrDefault(t => t.Id == TicketId);

            return(ticket);
        }
Esempio n. 7
0
        public List <Ticket_Game> GetAllUnsoldTickets()
        {
            WebAssignmentDbContext db = new WebAssignmentDbContext();
            string query       = "SELECT * FROM dbo.Ticket_Game WHERE sold = 0 and dbo.Ticket_Game.GameId = " + Id + "; ";
            var    ticketsInDb = db.Database.SqlQuery <Ticket_Game>(query).ToList();

            return(ticketsInDb);
        }
Esempio n. 8
0
        public List <Ticket_Game> GetAllAssignedTickets()
        {
            WebAssignmentDbContext db = new WebAssignmentDbContext();
            string query       = "SELECT * FROM dbo.Ticket JOIN dbo.Ticket_Game ON dbo.Ticket.Id = dbo.Ticket_Game.TicketId WHERE dbo.Ticket_Game.GameId = " + Id + "; ";
            var    ticketsInDb = db.Database.SqlQuery <Ticket_Game>(query).ToList();

            return(ticketsInDb);
        }
Esempio n. 9
0
        public List <Ticket_Game> GetAllAssignedGamesByCompetition(int competitionId)
        {
            WebAssignmentDbContext db = new WebAssignmentDbContext();
            string query     = "SELECT * FROM dbo.Game JOIN dbo.Ticket_Game ON dbo.Game.Id = dbo.Ticket_Game.GameId WHERE dbo.Ticket_Game.TicketId = " + Id + " and " + "dbo.Game.CompetitionId = " + competitionId + ";";
            var    gamesInDb = db.Database.SqlQuery <Ticket_Game>(query).ToList();

            return(gamesInDb);
        }
Esempio n. 10
0
        public List <Ticket_Game> GetAllUnsoldTicketsCategorized(int categoryId)
        {
            WebAssignmentDbContext db = new WebAssignmentDbContext();
            string query       = "SELECT * FROM dbo.Ticket JOIN dbo.Ticket_Game ON dbo.Ticket.Id = dbo.Ticket_Game.TicketId WHERE dbo.Ticket_Game.Sold=0 and dbo.Ticket_Game.GameId = " + Id + " and " + "dbo.Ticket.CategoryId = " + categoryId + ";";
            var    ticketsInDb = db.Database.SqlQuery <Ticket_Game>(query).ToList();

            return(ticketsInDb);
        }
Esempio n. 11
0
        public List <Ticket_Game> GetTicketGames()
        {
            WebAssignmentDbContext db = new WebAssignmentDbContext();
            string query = "SELECT Ticket_Game_Id FROM dbo.Order_Ticket_Game Where OrderId = " + Id + ";";
            var    tgids = db.Database.SqlQuery <int>(query).ToList();

            List <Ticket_Game> tglist = new List <Ticket_Game>();

            foreach (int id in tgids)
            {
                Ticket_Game tg = db.Ticket_Game.Single(m => m.Id == id);
                tglist.Add(tg);
            }

            return(tglist);
        }