Пример #1
0
 public PlaneTypeRepository()
 {
     SeedData.Add(new PlaneType {
         Id = 1, PlaneModel = "777", PlacesAmount = 114, CarryingCapacity = 52800
     });
     SeedData.Add(new PlaneType {
         Id = 2, PlaneModel = "A320", PlacesAmount = 40, CarryingCapacity = 15000
     });
     SeedData.Add(new PlaneType {
         Id = 3, PlaneModel = "100", PlacesAmount = 300, CarryingCapacity = 30000
     });
     SeedData.Add(new PlaneType {
         Id = 4, PlaneModel = "Ту-134", PlacesAmount = 80, CarryingCapacity = 47000
     });
 }
Пример #2
0
 public CrewRepository()
 {
     SeedData.Add(new Crew {
         Id = 1, Name = "Alpha"
     });
     SeedData.Add(new Crew {
         Id = 2, Name = "Bravo"
     });
     SeedData.Add(new Crew {
         Id = 3, Name = "Apolo"
     });
     SeedData.Add(new Crew {
         Id = 4, Name = "Delta"
     });
 }
Пример #3
0
        public async Task <IActionResult> InsertPage([Bind("RecipeId,Name,Description,Ingredients,Icon,Time,CreationDate")] Recipe recipe, IFormFile Icon) //List<IFormFile> files)
        {
            var uploadPath = Path.Combine(hostingEnvironment.WebRootPath, "uploads");

            if (ModelState.IsValid)
            {
                recipe.UserName     = User.Identity.Name.ToString();
                recipe.CreationDate = DateTime.Now;
                var nextRecipeId = _context.Recipes.Last().RecipeId + 1;
                if (Icon != null && Icon.Length > 0)
                {
                    var path     = recipe.UserName + recipe.Name + Path.GetExtension(Icon.FileName);
                    var fullPath = Path.Combine(uploadPath, path);
                    Icon.CopyTo(new FileStream(fullPath, FileMode.Create));
                    recipe.Icon = "\\uploads\\" + path;
                }

                _context.Add(recipe);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(DataPage)));
            }
            return(View(recipe));
        }
Пример #4
0
 public TicketRepository()
 {
     SeedData.Add(new Ticket {
         Id = 1, FlightId = 1, Price = 112
     });
     SeedData.Add(new Ticket {
         Id = 2, FlightId = 2, Price = 212
     });
     SeedData.Add(new Ticket {
         Id = 3, FlightId = 4, Price = 222.2
     });
     SeedData.Add(new Ticket {
         Id = 4, FlightId = 3, Price = 100
     });
 }
Пример #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              ILoggerFactory loggerFactory,
                              IServiceProvider serviceProvider,
                              IncidentContext incidentContext)
        {
            LoggingStartup.AddLogging(env, loggerFactory, serviceProvider, _configuration);

            app.AddMiddleware(env, _configuration);

            AutoMapperStartup.InitializeAutomapper();

            if (_env.IsDevelopment())
            {
                SeedType seedType = _configuration["seedDataType"] == "manyEvents" ? SeedType.ManyEvents : SeedType.Basic;

                SeedData.Add(incidentContext, seedType);
            }
        }
Пример #6
0
 public FlightRepository()
 {
     SeedData.Add(new Flight
     {
         Id              = 1,
         Number          = "12qwdf",
         TimeDeparture   = new DateTime(2016, 12, 5, 23, 15, 00),
         PlaceDeparture  = "London",
         Destination     = "Paris",
         TimeDestination = new DateTime(2016, 12, 6, 00, 15, 00)
     });
     SeedData.Add(new Flight
     {
         Id              = 2,
         Number          = "55abll",
         TimeDeparture   = new DateTime(2017, 11, 23, 13, 10, 00),
         PlaceDeparture  = "Lviv",
         Destination     = "Habana",
         TimeDestination = new DateTime(2017, 11, 23, 23, 55, 00)
     });
     SeedData.Add(new Flight
     {
         Id              = 3,
         Number          = "78qsco",
         TimeDeparture   = new DateTime(2018, 5, 11, 7, 30, 00),
         PlaceDeparture  = "Habana",
         Destination     = "London",
         TimeDestination = new DateTime(2018, 5, 11, 16, 10, 00)
     });
     SeedData.Add(new Flight
     {
         Id              = 4,
         Number          = "02fthn",
         TimeDeparture   = new DateTime(2017, 9, 7, 8, 00, 00),
         PlaceDeparture  = "Lisbon",
         Destination     = "Paris",
         TimeDestination = new DateTime(2017, 9, 7, 10, 30, 00),
     });
 }