// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, MotoGpContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); DbInitializer.Initialize(context); }
public InfoController(MotoGpContext motoGpContext) { dbContext = motoGpContext; }
public ShopController(MotoGpContext _motogpContext) { this.motoGpContext = _motogpContext; }
public static void Initialize(MotoGpContext context) { context.Database.EnsureCreated(); // Look for any countries. if (context.Countries.Any()) { return; // DB has been seeded } context.Countries.AddRange( new Country { Name = "Albania", CountryID = 1 }, new Country { Name = "Algeria", CountryID = 2 }, new Country { Name = "Andorra", CountryID = 3 }, new Country { Name = "Angola", CountryID = 4 }, new Country { Name = "Antigua", CountryID = 5 }, new Country { Name = "Argentina", CountryID = 6 }, new Country { Name = "Armenia", CountryID = 7 }, new Country { Name = "Australia", CountryID = 8 }, new Country { Name = "Austria", CountryID = 9 }, new Country { Name = "Azerbaijan", CountryID = 10 }, new Country { Name = "Bahamas", CountryID = 11 }, new Country { Name = "Bahrain", CountryID = 12 }, new Country { Name = "Bangladesh", CountryID = 13 }, new Country { Name = "Barbados", CountryID = 14 }, new Country { Name = "Belgium", CountryID = 15 }, new Country { Name = "Belize", CountryID = 16 }, new Country { Name = "Benin", CountryID = 17 }, new Country { Name = "Bhutan", CountryID = 18 }, new Country { Name = "Bolivia", CountryID = 19 }, new Country { Name = "Botswana", CountryID = 21 }, new Country { Name = "Brazil", CountryID = 22 }, new Country { Name = "Brunei", CountryID = 23 }, new Country { Name = "Bulgaria", CountryID = 24 }, new Country { Name = "Burkina", CountryID = 25 }, new Country { Name = "Burma", CountryID = 26 }, new Country { Name = "Burundi", CountryID = 27 }, new Country { Name = "Cambodia", CountryID = 28 }, new Country { Name = "Cameroon", CountryID = 29 }, new Country { Name = "Canada", CountryID = 30 }, new Country { Name = "Chad", CountryID = 33 }, new Country { Name = "Chile", CountryID = 34 }, new Country { Name = "China", CountryID = 35 }, new Country { Name = "Colombia", CountryID = 36 }, new Country { Name = "Comoros", CountryID = 37 }, new Country { Name = "Congo", CountryID = 38 }, new Country { Name = "Costa Rica", CountryID = 39 }, new Country { Name = "Cote d'Ivoire", CountryID = 40 }, new Country { Name = "Croatia", CountryID = 41 }, new Country { Name = "Cuba", CountryID = 42 }, new Country { Name = "Cyprus", CountryID = 43 }, new Country { Name = "Czech Republic", CountryID = 44 }, new Country { Name = "Denmark", CountryID = 45 }, new Country { Name = "Djibouti", CountryID = 46 }, new Country { Name = "Dominica", CountryID = 47 }, new Country { Name = "Ecuador", CountryID = 49 }, new Country { Name = "Egypt", CountryID = 50 }, new Country { Name = "El Salvador", CountryID = 51 }, new Country { Name = "Eritrea", CountryID = 53 }, new Country { Name = "Estonia", CountryID = 54 }, new Country { Name = "Ethiopia", CountryID = 55 }, new Country { Name = "Fiji", CountryID = 56 }, new Country { Name = "Finland", CountryID = 57 }, new Country { Name = "France", CountryID = 58 }, new Country { Name = "Gabon", CountryID = 59 }, new Country { Name = "Gambia", CountryID = 60 }, new Country { Name = "Georgia", CountryID = 61 }, new Country { Name = "Germany", CountryID = 62 }, new Country { Name = "Ghana", CountryID = 63 }, new Country { Name = "Gibraltar", CountryID = 64 }, new Country { Name = "Greece", CountryID = 65 }, new Country { Name = "Grenada", CountryID = 66 }, new Country { Name = "Guadeloupe", CountryID = 67 }, new Country { Name = "Guatemala", CountryID = 68 }, new Country { Name = "Guinea", CountryID = 69 }, new Country { Name = "Guinea-Bissau", CountryID = 70 }, new Country { Name = "Guyana", CountryID = 71 }, new Country { Name = "Haiti", CountryID = 72 }, new Country { Name = "Honduras", CountryID = 73 }, new Country { Name = "Hong Kong", CountryID = 74 }, new Country { Name = "Hungary", CountryID = 75 }, new Country { Name = "Iceland", CountryID = 76 }, new Country { Name = "India", CountryID = 77 }, new Country { Name = "Indonesia", CountryID = 78 }, new Country { Name = "Iran", CountryID = 79 }, new Country { Name = "Iraq", CountryID = 80 }, new Country { Name = "Irish Republic", CountryID = 81 }, new Country { Name = "Israel", CountryID = 82 }, new Country { Name = "Italy", CountryID = 83 }, new Country { Name = "Jamaica", CountryID = 84 }, new Country { Name = "Japan", CountryID = 85 }, new Country { Name = "Jordan", CountryID = 86 }, new Country { Name = "Afghanistan", CountryID = 194 }, new Country { Name = "Bosnia-Herzegovina", CountryID = 195 }, new Country { Name = "Cape Verde Islands", CountryID = 196 }, new Country { Name = "Central African Republic", CountryID = 197 }, new Country { Name = "Dominican Republic", CountryID = 198 }, new Country { Name = "Equatorial Guinea", CountryID = 199 }, new Country { Name = "Marshall Islands", CountryID = 200 }, new Country { Name = "Sao Tome and Principe", CountryID = 201 }, new Country { Name = "Trinidad & Tobago", CountryID = 202 }, new Country { Name = "United Arab Emirates", CountryID = 203 }, new Country { Name = "Kazakhstan", CountryID = 87 }, new Country { Name = "Kenya", CountryID = 88 }, new Country { Name = "Kirgizstan", CountryID = 89 }, new Country { Name = "Kiribati", CountryID = 90 }, new Country { Name = "Korea (North)", CountryID = 91 }, new Country { Name = "Korea (South)", CountryID = 92 }, new Country { Name = "Kuwait", CountryID = 93 }, new Country { Name = "Laos", CountryID = 94 }, new Country { Name = "Latvia", CountryID = 95 }, new Country { Name = "Lebanon", CountryID = 96 }, new Country { Name = "Lesotho", CountryID = 97 }, new Country { Name = "Liberia", CountryID = 98 }, new Country { Name = "Libya", CountryID = 99 }, new Country { Name = "Liechtenstein", CountryID = 100 }, new Country { Name = "Lithuania", CountryID = 101 }, new Country { Name = "Luxembourg", CountryID = 102 }, new Country { Name = "Macedonia", CountryID = 103 }, new Country { Name = "Madagascar", CountryID = 104 }, new Country { Name = "Malawi", CountryID = 105 }, new Country { Name = "Malaysia", CountryID = 106 }, new Country { Name = "Maldives", CountryID = 107 }, new Country { Name = "Mali", CountryID = 108 }, new Country { Name = "Malta", CountryID = 109 }, new Country { Name = "Mauritania", CountryID = 111 }, new Country { Name = "Mauritius", CountryID = 112 }, new Country { Name = "Mexico", CountryID = 113 }, new Country { Name = "Micronesia", CountryID = 114 }, new Country { Name = "Moldova", CountryID = 115 }, new Country { Name = "Monaco", CountryID = 116 }, new Country { Name = "Mongolia", CountryID = 117 }, new Country { Name = "Morocco", CountryID = 118 }, new Country { Name = "Mozambique", CountryID = 119 }, new Country { Name = "Namibia", CountryID = 120 }, new Country { Name = "Nauru", CountryID = 121 }, new Country { Name = "Nepal", CountryID = 122 }, new Country { Name = "Netherlands", CountryID = 123 }, new Country { Name = "New Zealand", CountryID = 124 }, new Country { Name = "Nicaragua", CountryID = 125 }, new Country { Name = "Niger", CountryID = 126 }, new Country { Name = "Nigeria", CountryID = 127 }, new Country { Name = "Norway", CountryID = 128 }, new Country { Name = "Oman", CountryID = 129 }, new Country { Name = "Pakistan", CountryID = 130 }, new Country { Name = "Panama", CountryID = 131 }, new Country { Name = "Papua New Guinea", CountryID = 132 }, new Country { Name = "Paraguay", CountryID = 133 }, new Country { Name = "Peru", CountryID = 134 }, new Country { Name = "Philippines", CountryID = 135 }, new Country { Name = "Poland", CountryID = 136 }, new Country { Name = "Portugal", CountryID = 137 }, new Country { Name = "Puerto Rico", CountryID = 138 }, new Country { Name = "Qatar", CountryID = 139 }, new Country { Name = "Romania", CountryID = 140 }, new Country { Name = "Russia", CountryID = 141 }, new Country { Name = "Rwanda", CountryID = 142 }, new Country { Name = "Saint Kitts", CountryID = 143 }, new Country { Name = "Saint Lucia", CountryID = 144 }, new Country { Name = "Saint Vincent", CountryID = 145 }, new Country { Name = "Samoa", CountryID = 146 }, new Country { Name = "San Marino", CountryID = 147 }, new Country { Name = "Saudi Arabia", CountryID = 149 }, new Country { Name = "Senegal", CountryID = 150 }, new Country { Name = "Seychelles", CountryID = 151 }, new Country { Name = "Sierra Leone", CountryID = 152 }, new Country { Name = "Singapore", CountryID = 153 }, new Country { Name = "Slovakia", CountryID = 154 }, new Country { Name = "Slovenia", CountryID = 155 }, new Country { Name = "Solomon Islands", CountryID = 156 }, new Country { Name = "Somalia", CountryID = 157 }, new Country { Name = "South Africa", CountryID = 158 }, new Country { Name = "Spain", CountryID = 159 }, new Country { Name = "Sri Lanka", CountryID = 160 }, new Country { Name = "Sudan", CountryID = 161 }, new Country { Name = "Suriname", CountryID = 162 }, new Country { Name = "Swaziland", CountryID = 163 }, new Country { Name = "Sweden", CountryID = 164 }, new Country { Name = "Switzerland", CountryID = 165 }, new Country { Name = "Syria", CountryID = 166 }, new Country { Name = "Tahiti", CountryID = 167 }, new Country { Name = "Taiwan", CountryID = 168 }, new Country { Name = "Tajikistan", CountryID = 169 }, new Country { Name = "Tanzania", CountryID = 170 }, new Country { Name = "Thailand", CountryID = 171 }, new Country { Name = "Togo", CountryID = 172 }, new Country { Name = "Tonga", CountryID = 173 }, new Country { Name = "Tunisia", CountryID = 175 }, new Country { Name = "Turkey", CountryID = 176 }, new Country { Name = "Turkmenistan", CountryID = 177 }, new Country { Name = "Tuvalu", CountryID = 178 }, new Country { Name = "Uganda", CountryID = 179 }, new Country { Name = "Ukraine", CountryID = 180 }, new Country { Name = "United Kingdom", CountryID = 182 }, new Country { Name = "United States", CountryID = 183 }, new Country { Name = "Uruguay", CountryID = 184 }, new Country { Name = "Uzbekistan", CountryID = 185 }, new Country { Name = "Vanuatu", CountryID = 186 }, new Country { Name = "Venezuela", CountryID = 187 }, new Country { Name = "Vietnam", CountryID = 188 }, new Country { Name = "White Russia", CountryID = 189 }, new Country { Name = "Yemen", CountryID = 190 }, new Country { Name = "Zaire", CountryID = 191 }, new Country { Name = "Zambia", CountryID = 192 }, new Country { Name = "Zimbabwe", CountryID = 193 } ); context.SaveChanges(); context.Teams.AddRange( new Team { TeamID = 1, Name = "Avintia Racing", Logo = "Avintia.PNG" }, new Team { TeamID = 2, Name = "Cardion AB Motoracing", Logo = "AB.PNG" }, new Team { TeamID = 3, Name = "Ducati Team", Logo = "Ducati.PNG" }, new Team { TeamID = 4, Name = "LCR Honda MotoGP", Logo = "LCR.PNG" }, new Team { TeamID = 5, Name = "Repsol Honda Team", Logo = "Repsol.PNG" }, new Team { TeamID = 6, Name = "Drive M7 Aspar", Logo = "M7.PNG" }, new Team { TeamID = 7, Name = "IodaRacing Project", Logo = "ioda.PNG" } ); context.SaveChanges(); context.Races.AddRange( new Race { Country = "Netherlands", Name = "Assen", Description = "Assen is the only venue to have held a round of the Motorcycle World Championship every year since its creation in 1949. The circuit was purpose built for the Dutch TT in 1954, with previous events having been held on public roads. The track is narrow, with rapid changes in direction, and is fully surrounded by grass banks and grandstands, providing excellent viewing for the hundreds of thousands of fanatical spectators who are drawn to the most prestigious event in Dutch motorsport every year. A huge favourite with riders, Assen is well known for its festive and extravagant atmosphere.", Length = 4542, Date = DateTime.Parse("2017-06-28"), X = 517, Y = 19 }, new Race { Country = "Qatar", Name = "Losail Circuit", Description = "The fabulous Losail International Circuit lies on the outskirts of Doha, the capital city of Qatar. Built in little over a year, the track cost $58 million USD and required round-the-clock dedication from almost 1,000 workers in order to get it ready for the inaugural event - the Marlboro Grand Prix of Qatar on the 2nd October 2004.", Length = 5380, Date = DateTime.Parse("2017-04-23"), X = 859, Y = 249 }, new Race { Country = "Argentina", Name = "Autódromo Termas de Río Hondo", Description = "One of its more distinctive features is near 41m-elevation change with an impressive incline at the end of the home-straight followed by a sharp left. The circuit is one of the most varied on the GP circuit, with a mix of fast straights and tight hairpins, with most sections mirroring at least some part of a famous track around the world.", Length = 5201, Date = DateTime.Parse("2017-04-27"), X = 194, Y = 428 }, new Race { Country = "Spain", Name = "Jerez", Description = "Built in 1986 and hosting its first Grand Prix one year later, the circuit of Jerez is now one of the most popular MotoGP venues and the focal point for a city fanatical about sport. Set in a slight valley in the south of Spain, Jerez is blessed with consistently good weather and beautiful scenery, its numerous grandstands providing the perfect viewing facilities for up to 250,000 spectators.", Length = 4423, Date = DateTime.Parse("2017-05-04"), X = 342, Y = 169 }, new Race { Country = "France", Name = "Le Mans", Description = "Le Mans is a tight track dominated by first gear corners that place the emphasis on late braking and hard acceleration, whilst rear end traction is also a key area. With the capacity to comfortably accommodate up to 100,000 spectators, the Bugatti circuit also plays host to the 24 hour truck race, the FIA GP2 Championship, French Touring Car and GT races.", Length = 4185, Date = DateTime.Parse("2017-05-18"), X = 564, Y = 161 }, new Race { Country = "Germany", Name = "Sachsenring", Description = "Car and bike races have been held on closed public roads in the area around the town of Chemnitz, Germany since the 1920s and were still taking place until as recently as 1990. It was decided, however, that the five mile course through such a densely populated area was no longer suitable and a new circuit was built five miles west of Chemnitz in 1996. Although mainly used as a driver training centre and road transport safety station, Sachsenring first hosted MotoGP in 1998 and many improvements have taken place since then, including a drastic layout enhancement in 2001. Numerous tight corners make it one of the slower tracks on the calendar but there is never any shortage of close racing action.", Length = 3671, Date = DateTime.Parse("2017-08-13"), X = 645, Y = 53 }, new Race { Country = "United States", Name = "Indianapolis Motor Speedway", Description = "The first motorsport race which took place at Indy was a motorcycle one on August 14th 1909, on the 2.5 mile oval circuit, and despite its 100-year history it was not until 2008 that MotoGP arrived at the Indianapolis Motor Speedway.", Length = 4216, Date = DateTime.Parse("2017-10-10"), X = 21, Y = 114 }, new Race { Country = "Great Britain", Name = "Silverstone", Description = "With more than 60 years of history Silverstone has become one of the most prestigious venues dedicated to motorsport. Completely revamped in recent years, a multimillion pound investment saw the completion in 2010 of a first phase of works to greatly improve the venue, making it one of the fastest tracks on the MotoGP calendar and earning high praise from the World Championship riders who enjoyed the new layout. The ‘Silverstone Wing’, a state-of-the-art, multi-million pound complex, became a new landmark at the circuit from 2011, thus adding to already breathtaking facilities at Silverstone.", Length = 5900, Date = DateTime.Parse("2017-08-15"), X = 354, Y = 69 }, new Race { Country = "Italy", Name = "Misano World Circuit", Description = "Close to the city of Rimini, the Misano Adriático circuit was constructed in 1972 and has since undergone an array of modifications. A regular scene for Italian Grands Prix throughout the 80s and early 90s, Misano returned to the MotoGP calendar in 2007.With updated facilities, track and grandstands, the Misano Adriatico holds a maximum capacity of 60,000 spectators. In accordance with MotoGP safety regulations, the 4,200m track runs clockwise for the World Championship races.", Length = 4226, Date = DateTime.Parse("2017-08-14"), X = 502, Y = 337 }, new Race { Country = "Japan", Name = "Motegi", Description = "Located amongst the vast natural beauty of the northern Kanto district, the twin ring circuit at Motegi in Japan consists of a 1.5 mile oval and a 2.9 mile road course constructed to international standards. Built by Honda as the ultimate test facility in August 1997, the road circuit became home to MotoGP in 2000 whilst the oval is designed to introduce American motorsports culture to the country.", Length = 4801, Date = DateTime.Parse("2017-10-12"), X = 921, Y = 132 }, new Race { Country = "Malaysia", Name = "Sepang Circuit", Description = "Specifically built for speed and exciting racing, the Sepang International Circuit in Malaysia is one of the world’s best. The 2,300 acre complex which also houses a hotel, shopping centre, golf course and other sports facilities cost around £50m to construct and was built in just 14 months, holding its first Grand Prix in April 1999 and setting the standard for race circuits worldwide.", Length = 5548, Date = DateTime.Parse("2017-10-26"), X = 700, Y = 275 }, new Race { Country = "Spain", Name = "Comunitat Valenciana", Description = "The Circuito de la Comunitat Valenciana was completed in 1999 and held rounds of the MotoGP and Spanish Motorcycle Championships in the same year. The Cheste track has several layouts, running anti-clockwise with varying lengths. MotoGP events are held on a 4km track comprising of five right handed corners, eight left handers and a 650m straight. Although the track is regarded as quite small, the pit complex contains 48 garages whilst the stadium style grandstands can seat up to 150,000 spectators. The circuit layout which allows all parts of the circuit to be seen from any stand helps to create a unique atmosphere enjoyed by Spanish and international riders alike and as the last race of the season there is always a party feeling to the Grand Prix, which was voted best GP of 2005 by IRTA.", Length = 4005, Date = DateTime.Parse("2017-06-09"), X = 649, Y = 363 } ); context.SaveChanges(); context.Riders.AddRange( new Rider { LastName = "Barbera", FirstName = "Hector", CountryID = 159, TeamID = 1, Bike = "FTR", Number = 8 }, new Rider { LastName = "Di Meglio", FirstName = "Mike", CountryID = 58, TeamID = 1, Bike = "FTR", Number = 63 }, new Rider { LastName = "Abraham", FirstName = "Karel", CountryID = 44, TeamID = 2, Bike = "Honda", Number = 17 }, new Rider { LastName = "Aoyama", FirstName = "Hiroshi", CountryID = 85, TeamID = 6, Bike = "Honda", Number = 7 }, new Rider { LastName = "Hayden", FirstName = "Niki", CountryID = 183, TeamID = 6, Bike = "Honda", Number = 69 }, new Rider { LastName = "Dovizioso", FirstName = "Andrea", CountryID = 83, TeamID = 3, Bike = "Ducati", Number = 4 }, new Rider { LastName = "Crutchlow", FirstName = "Cal", CountryID = 182, TeamID = 3, Bike = "Ducati", Number = 35 }, new Rider { LastName = "Camier", FirstName = "Leon", CountryID = 182, TeamID = 7, Bike = "ART", Number = 2 }, new Rider { LastName = "Petrucci", FirstName = "Danilo", CountryID = 83, TeamID = 7, Bike = "ART", Number = 9 }, new Rider { LastName = "Bradl", FirstName = "Stefan", CountryID = 62, TeamID = 4, Bike = "Honda", Number = 6 }, new Rider { LastName = "Pedrosa", FirstName = "Dani", CountryID = 159, TeamID = 5, Bike = "Honda", Number = 26 }, new Rider { LastName = "Marquez", FirstName = "Marc", CountryID = 159, TeamID = 5, Bike = "Honda", Number = 93 } ); context.SaveChanges(); context.Tickets.AddRange( new Ticket { Name = "Max Verstappen", Email = "*****@*****.**", Address = "Amsterdam", CountryID = 123, RaceID = 1, Number = 5, OrderDate = DateTime.Parse("2017-01-24"), Paid = false }, new Ticket { Name = "Stef Wouters", Email = "*****@*****.**", Address = "Brussels", CountryID = 15, RaceID = 1, Number = 3, OrderDate = DateTime.Parse("2017-01-23"), Paid = true }, new Ticket { Name = "Bart De Molenaar", Email = "*****@*****.**", Address = "Antwerpen", CountryID = 15, RaceID = 1, Number = 2, OrderDate = DateTime.Parse("2017-01-22"), Paid = false }, new Ticket { Name = "Arjen Lubach", Email = "*****@*****.**", Address = "Hilversum", CountryID = 123, RaceID = 4, Number = 2, OrderDate = DateTime.Parse("2017-01-18"), Paid = false }); context.SaveChanges(); }