Ejemplo n.º 1
0
        public static void EnsureSeeded(this DatabaseContext context)
        {
            if (!context.FoodTypes.Any())
            {
                var types = JsonConvert.DeserializeObject <List <FoodType> >(File.ReadAllText("seed" + Path.DirectorySeparatorChar + "foodType.json"));
                context.AddRange(types);
                context.SaveChanges();
            }

            //Ensure we have some status
            if (!context.Nutrients.Any())
            {
                var nutrients = JsonConvert.DeserializeObject <List <Nutrient> >(File.ReadAllText(@"seed" + Path.DirectorySeparatorChar + "nutrient.json"));
                context.AddRange(nutrients);
                context.SaveChanges();
            }

            //Ensure we create initial Threat List
            if (!context.Foods.Any())
            {
                List <Food> foods = JsonConvert.DeserializeObject <List <Food> >(File.ReadAllText(@"seed" + Path.DirectorySeparatorChar + "food.json"));
                context.Foods.AddRange(foods);
                context.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create(int id, [Bind("Id,Name,TypeId")] Spoj spoj, ICollection <int> Elements)
        {
            if (Elements.Count >= Spoj.MinSizeOfElements)
            {
                _context.Add(spoj);
                if (ModelState.IsValid)
                {
                    var list = new List <SpojElement>();
                    foreach (var elem in Elements)
                    {
                        //until the ui supports entering count for each element set it to 1 and later edit it
                        list.Add(new SpojElement()
                        {
                            Count = 1, ElementId = elem, SpojId = spoj.Id
                        });
                    }



                    _context.AddRange(list);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            ViewDataSet();
            var spojVM = new SpojVM();

            return(View(spojVM));
        }
Ejemplo n.º 3
0
        public static void Seed(DatabaseContext context)
        {
            if (!context.Cars.Any())
            {
                context.AddRange(
                    new Car {
                    Id = 1, Title = "Ford Mustang", Description = "Mam do sprzedania Mustanga 5.0 GT V8 421KM w benzynie. Kupiony w Polskim SALONIE FORDA w Opolu jako NOWY w kwietniu 2016. Do chwili obecnej jest przejechane 34 000 km. Cena jaka mnie interesuje to 160 000 PLN.", PhotoUrl = "/images/fordMustang.jpg", MiniaturePhotoUrl = "/images/fordMustang.jpg"
                },
                    new Car {
                    Id = 2, Title = "Audi S5", Description = "Do sprzedania Audi S5 z silnikiem benzynowym o pojemności 3000 cm3 i mocy 280 KM z 2013 roku.  Jestem właścicielem tego samochodu od ponad dwóch lat. Obecny przebieg to 112 000km", PhotoUrl = "/images/audiS5.jpg", MiniaturePhotoUrl = "/images/audiS5.jpg"
                },
                    new Car {
                    Id = 3, Title = "BMV X4", Description = "BMV X4 20d xDrive z silnikiem benzynowym o pojemnosci 2000 cm3 i mocy 190 KM. Samochód krajowy, kupiony w 2017 roku. Przebieg samochodu jest niewielki bo tylko 4300 km. Samochód serwisowany. Wystawiamy fakturę VAT 23%. Samochód bezwypadkowy. I właściciel.", PhotoUrl = "/images/bmvx4.jpg", MiniaturePhotoUrl = "/images/bmvx4.jpg"
                },
                    new Car {
                    Id = 4, Title = "Chevrolet Corvette", Description = "Corvetta jest w świetnym stanie wizualnym i mechanicznym. Autko wyprodukowane w 1972 roku. obecnie jego przebieg wynosi 180 000 km Oczywiście jest ZAREJESTROWANA i ubezpieczona w PL. Samochód ma pojemność 5700 cm3 i moc 300 KM> Cena to 90 000 PLN", PhotoUrl = "/images/chevroletCorvete.jpg", MiniaturePhotoUrl = "/images/chevroletCorvete.jpg"
                },
                    new Car {
                    Id = 5, Title = "Nissan Skyline", Description = "Na sprzedaż trafia moja perełka Nissan Skyline R33.Auto z Japonii sprowadzone do Szwecji, gdzie było przez wiele lat modyfikowane, uczestniczyło w zlotach, zdobywało nagrody, samochód sponsorowany latami przez Sonax Sweden. Samochód wyprodukowany w 1995 roku, jego przebieg 144 000 km potwierdzony książką serwisową. Autko posiada silnik o pojemności 2500 cm3 i moc 410 KM. Cena za to wspaniałe autko to 120 000 PLN", PhotoUrl = "/images/nissan.jpg", MiniaturePhotoUrl = "/images/nissan.jpg",
                },
                    new Car {
                    Id = 6, Title = "Jaguar ZX", Description = "Przedstawiam Państwu wyjątkowe auto jakim jest Jaguar XKR, a zwłaszcza ten egzemplarz. Jaguar XKR to ikona światowej i brytyjskiem motoryzacji, a przede wszystkim kontynuator legendarnego już Jaguara E-typa, przez wielu uważany za najpiękniejsze auto w historii motoryzacji. Autko wyprodukowane w 2006 roku, Obecnie ma przejechane 78000 km, posiada najmocniejszy dostępny seryjnie montowany silnik o pojemności 5000 cm3 i mocy 510 KM. Cena za ten wspaniały samochód to 25 000 PLN.", PhotoUrl = "/images/jaguar.jpg", MiniaturePhotoUrl = "/images/jaguar.jpg"
                }

                    );
            }


            context.SaveChanges();
        }
Ejemplo n.º 4
0
        private void Seed(DatabaseContext db)
        {
            var country = new Country()
            {
                Id   = 1,
                Name = "Poland"
            };

            var provincy = new Provincy()
            {
                Id      = 1,
                Country = country,
                Name    = "podkarpackie"
            };

            var cities = new[]
            {
                new City()
                {
                    Id = 1, Provincy = provincy, Name = "Test1"
                },
                new City()
                {
                    Id = 2, Provincy = provincy, Name = "Test2"
                },
            };

            db.AddRange(cities);
            db.SaveChanges();
        }
Ejemplo n.º 5
0
        private void Seed()
        {
            using (var context = new DatabaseContext(databaseContextOptions, httpAccessorMock.Object)) {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                argumentQuery = new ReportArgumentQuery()
                {
                    ArgQuery = "query", ReportArgumentQueryId = 1
                };
                reportArgument = new ReportArgument {
                    Name = "date", ReportArgumentId = 1, ArgType = "DateTime", ReportId = 1
                };
                group = new ReportGroup()
                {
                    Name = "groupName", ReportGroupId = 1
                };
                report = new Report()
                {
                    Description     = "someDescription",
                    Name            = "someName",
                    ReportId        = reportArgument.ReportId,
                    ReportArguments = new List <ReportArgument>()
                    {
                        reportArgument
                    },
                    ReportGroupId = group.ReportGroupId
                };

                context.AddRange(argumentQuery, reportArgument, group, report);
                context.SaveChanges();
            }
        }
Ejemplo n.º 6
0
        public static void EnsureSeeded(this DatabaseContext context)
        {
            // Ensure we create initial admin user
            if (!context.Users.Any())
            {
                var users = JsonConvert.DeserializeObject <List <User> >(File.ReadAllText(@"seed" + Path.DirectorySeparatorChar + "users.json"));
                context.AddRange(users);
                context.SaveChanges();
            }

            // Ensure we create initial admin role
            if (!context.Roles.Any())
            {
                //var roles = JsonConvert.DeserializeObject<List<Role>>(File.ReadAllText(@"seed" + Path.DirectorySeparatorChar + "roles.json"));
                //context.AddRange(roles);
                //context.SaveChanges();
            }

            // Ensure we create initial admin profile
            if (!context.UserProfiles.Any())
            {
                //List<UserProfile> profiles = JsonConvert.DeserializeObject<List<UserProfile>>(File.ReadAllText(@"seed" + Path.DirectorySeparatorChar + "profiles.json"));
                //context.UserProfiles.AddRange(profiles);
                //context.SaveChanges();
            }
        }
        public void GivenSearchParametersStatusFilterUpperCaseMatchingOrganisationsGetReturned()
        {
            var organisations = EntityHelpers.CreateOrganisations(10).ToList();
            var orgToFind     = EntityHelpers.CreateOrganisation();

            orgToFind.Status = "published";
            organisations.Add(orgToFind);
            DatabaseContext.AddRange(organisations);
            DatabaseContext.SaveChanges();
            var searchParams = new OrganisationSearchRequest();

            searchParams.Search    = orgToFind.Name;
            searchParams.Sort      = "Name";
            searchParams.Status    = "PUBLISHED";
            searchParams.Direction = SortDirection.Asc.ToString();
            var gatewayResult = _classUnderTest.SearchOrganisations(searchParams).Result;

            gatewayResult.Should().NotBeNull();
            gatewayResult.First().Should().BeEquivalentTo(orgToFind, options =>
            {
                options.Excluding(ex => ex.ReviewerU);
                options.Excluding(ex => ex.Services);
                options.Excluding(ex => ex.UserOrganisations);
                return(options);
            });
        }
        protected override async Task Seed(DatabaseContext db)
        {
            if (db.Bookmarks.Any())
            {
                return;
            }

            db.AddRange(new object[]
            {
                new Bookmark()
                {
                    url     = "https://www.google.nl",
                    user_id = 1
                },
                new Bookmark()
                {
                    url     = "https://www.dumpert.nl",
                    user_id = 1
                },
                new Bookmark()
                {
                    url     = "https://www.tweakers.nl",
                    user_id = 1
                },
                new Bookmark()
                {
                    url     = "https://www.nu.nl",
                    user_id = 2
                },
            });

            await db.SaveChangesAsync();
        }
        public async Task InitAsync()
        {
            var currentSeason = await context.Seasons.OrderByDescending(o => o.EndDate).FirstOrDefaultAsync();

            if (currentSeason.EndDate > dateTimeProvider.Now)
            {
                return;
            }

            var progresses = await context.Users
                             .Select(o => new SeasonProgress()
            {
                SeasonId = currentSeason.Id,
                UserId   = o.Id,
                Position = context.FighterEloRatings
                           .Where(r => r.CurrentElo > (context.FighterEloRatings.Where(e => e.Fighter.UserId == o.Id).FirstOrDefault() == null ? 0 : context.FighterEloRatings.Where(e => e.Fighter.UserId == o.Id).OrderByDescending(e => e.CurrentElo).FirstOrDefault().CurrentElo)).Count(),
            }).ToListAsync();

            await seasonMatchRemover.RemoveAsync(context);

            context.AddRange(progresses);
            context.Add(await seasonCreator.CreateAsync());
            await context.SaveChangesAsync();

            foreach (var progress in progresses)
            {
                backgroundJobClient.Enqueue <ISeasonUserJob>(o => o.ExecuteAsync(progress.SeasonId, progress.UserId));
            }
        }
        private void ResetFighter(Fighter fighter, Random random, DatabaseContext context)
        {
            fighter.Level = 0;

            if (fighter.Configuration != null)
            {
                fighter.Configuration.AttunementId = null;
            }

            fighterLevelUpHandler.Up(fighter);

            var armorHead      = equipmentGenerator.GenerateArmorHead(fighter.Level, ItemRarity.Basic, fighter.UserId);
            var armorShoulders = equipmentGenerator.GenerateArmorShoulders(fighter.Level, ItemRarity.Basic, fighter.UserId);
            var armorChest     = equipmentGenerator.GenerateArmorChest(fighter.Level, ItemRarity.Basic, fighter.UserId);
            var armorHands     = equipmentGenerator.GenerateArmorHands(fighter.Level, ItemRarity.Basic, fighter.UserId);
            var armorLegs      = equipmentGenerator.GenerateArmorLegs(fighter.Level, ItemRarity.Basic, fighter.UserId);
            var armorShoes     = equipmentGenerator.GenerateArmorShoes(fighter.Level, ItemRarity.Basic, fighter.UserId);

            var weaponType = EquipmentConstants.Weapons.Random(random);
            var weapon     = equipmentGenerator.GenerateEquipment(weaponType, fighter.Level, ItemRarity.Basic, fighter.UserId);

            fighterOutfitter.Equip(fighter, armorHead, true);
            fighterOutfitter.Equip(fighter, armorShoulders, true);
            fighterOutfitter.Equip(fighter, armorChest, true);
            fighterOutfitter.Equip(fighter, armorHands, true);
            fighterOutfitter.Equip(fighter, armorLegs, true);
            fighterOutfitter.Equip(fighter, armorShoes, true);

            fighterOutfitter.Equip(fighter, weapon, true);

            context.AddRange(armorHead, armorShoulders, armorChest, armorHands, armorLegs, armorShoes, weapon);
        }
Ejemplo n.º 11
0
        public async Task GetIncidentByIdAsyncShouldReturnNullIfThereNoMatchingId()
        {
            int testId = 110;

            optionsBuilder.UseInMemoryDatabase("GetIncidentByIdAsyncShouldReturnNullIfThereNoMatchingId");
            using (var context = new DatabaseContext(optionsBuilder.Options))
            {
                context.AddRange
                (
                    new Incident {
                    Description = "Regular 'dividing by zero' incident, nothing special", Status = "Opened"
                },
                    new Incident {
                    Description = "Pug-dog rebellion", Status = "Pending"
                },
                    new Incident {
                    Description = "Grass is green", Status = "Declined"
                }
                );

                IIncidentService testIncidentService = new IncidentService(context);
                var incident = await testIncidentService.GetIncidentByIdAsync(testId);

                Assert.AreEqual(null, incident);
            }
        }
Ejemplo n.º 12
0
        public void GivenAnIdAndStartDateAllMatchingAnalyticsEventsGetReturned()
        {
            var analyticsEvents = EntityHelpers.CreateAnalyticsEvents().ToList();
            var org             = analyticsEvents[0].Service.Organisation;

            analyticsEvents[1].Service.Organisation   = org;
            analyticsEvents[1].Service.OrganisationId = org.Id;
            analyticsEvents[2].Service.Organisation   = org;
            analyticsEvents[2].Service.OrganisationId = org.Id;
            analyticsEvents[0].TimeStamp = new DateTime(2020, 4, 11, 11, 0, 0);
            analyticsEvents[1].TimeStamp = new DateTime(2020, 4, 11, 11, 0, 0);
            analyticsEvents[2].TimeStamp = new DateTime(2020, 1, 11, 11, 0, 0);
            var startDate = new DateTime(2020, 4, 11, 10, 0, 0);

            DatabaseContext.AddRange(analyticsEvents);
            DatabaseContext.SaveChanges();
            var analyticsEventQuery = new AnalyticsEventQuery
            {
                OrganisationId = org.Id,
                StartDateTime  = startDate
            };
            var gatewayResult  = _classUnderTest.GetAnalyticsEvents(analyticsEventQuery);
            var expectedResult = DatabaseContext.AnalyticsEvents
                                 .Where(x => x.Service.OrganisationId == analyticsEventQuery.OrganisationId)
                                 .Where(x => x.TimeStamp >= analyticsEventQuery.StartDateTime);

            gatewayResult.Should().NotBeNull();
            gatewayResult.Should().BeEquivalentTo(expectedResult, options =>
            {
                options.Excluding(ex => ex.Service);
                return(options);
            });
            gatewayResult.Count.Should().Be(2);
        }
Ejemplo n.º 13
0
        public async Task GetAllIncidentsAsyncShouldReturnAllIncidents()
        {
            optionsBuilder.UseInMemoryDatabase("GetAllIncidentsAsyncShouldReturnAllIncidents");
            using (var context = new DatabaseContext(optionsBuilder.Options))
            {
                context.AddRange
                (
                    new Incident {
                    Description = "Regular 'dividing by zero' incident, nothing special", Status = "Opened"
                },
                    new Incident {
                    Description = "Pug-dog rebellion", Status = "Pending"
                },
                    new Incident {
                    Description = "Grass is green", Status = "Declined"
                }
                );
                context.SaveChanges();

                IIncidentService testIncidentService = new IncidentService(context);
                var incidents = await testIncidentService.GetAllIncidentsAsync();

                incidents.ToList();

                Assert.AreEqual(3, incidents.Count());
            }
        }
Ejemplo n.º 14
0
        public async Task GetSingleIncidentByExpressionAsyncShouldReturnSingleIncidentByExpressionIncidentById()
        {
            int testId = 3;
            Expression <Func <Incident, bool> > testExpression = IncidentQueries.IncidentById(testId);

            optionsBuilder.UseInMemoryDatabase("GetSingleIncidentByExpressionAsyncShouldReturnSingleIncidentByExpressionIncidentById");
            using (var context = new DatabaseContext(optionsBuilder.Options))
            {
                context.AddRange
                (
                    new Incident {
                    Description = "Regular 'dividing by zero' incident, nothing special", Status = "Opened"
                },
                    new Incident {
                    Description = "Pug-dog rebellion", Status = "Pending"
                },
                    new Incident {
                    Description = "Grass is green", Status = "Declined"
                }
                );

                IIncidentService testIncidentService = new IncidentService(context);
                var incident = await testIncidentService.GetSingleIncidentByExpressionAsync(testExpression);

                Assert.AreNotEqual(null, incident);
                Assert.AreEqual(testId, incident.IncidentId);
            }
        }
        public async Task GetOrganisationByIdReturnsOrganisation()
        {
            var session = EntityHelpers.CreateSession("Admin");

            DatabaseContext.Sessions.Add(session);
            Client.DefaultRequestHeaders.Add("Cookie", $"access_token={session.Payload}");

            var analyticsEvents = EntityHelpers.CreateAnalyticsEvents().ToList();
            var org             = analyticsEvents[0].Service.Organisation;

            analyticsEvents[1].Service.Organisation   = org;
            analyticsEvents[1].Service.OrganisationId = org.Id;
            DatabaseContext.AddRange(analyticsEvents);
            DatabaseContext.SaveChanges();

            var requestUri = new Uri($"api/v1/analytics-event/?organisationid={org.Id}", UriKind.Relative);
            var response   = await Client.GetAsync(requestUri).ConfigureAwait(true);

            response.StatusCode.Should().Be(200);
            var content        = response.Content;
            var stringResponse = await content.ReadAsStringAsync().ConfigureAwait(true);

            var deserializedBody = JsonConvert.DeserializeObject <AnalyticsResponseList>(stringResponse);

            deserializedBody.Should().NotBeNull();
        }
Ejemplo n.º 16
0
        private async Task IndexNewEpisodes(string[] newFiles, Library library)
        {
            var newEpisodes = FileIndexer.IndexEpisodeFiles(newFiles, library.Id).ToList();
            var details     = await _metadataService.FindSeriesDetails(newEpisodes, library);

            if (!details.Any())
            {
                return;
            }

            await _deduplicationService.DeduplicateEntities(details, d => d.Genres);

            await _deduplicationService.DeduplicateEntities(details, d => d.CreatedBy);

            var newProductionCompanyIds =
                await _deduplicationService.DeduplicateEntities(details, d => d.ProductionCompanies);

            var newNetworkIds = await _deduplicationService.DeduplicateEntities(details, d => d.Networks);

            await _deduplicationService.DeduplicateSeriesMetadata(details);

            _context.AddRange(newEpisodes);
            await _context.SaveChangesAsync();

            await _distributedCache.ClearList("overview", "sys");

            foreach (var detail in details)
            {
                _backgroundJobClient.Enqueue <ImageProcessor>(service => service.ProcessSeries(detail.Id));
            }
            if (newNetworkIds.Any())
            {
                _backgroundJobClient.Enqueue <ImageProcessor>(service => service.ProcessNetworks(newNetworkIds));
            }
            if (newProductionCompanyIds.Any())
            {
                _backgroundJobClient.Enqueue <ImageProcessor>(service =>
                                                              service.ProcessProductionCompanies(newProductionCompanyIds));
            }

            foreach (var episodes in newEpisodes.GroupBy(e => e.SeriesDetailsId))
            {
                _backgroundJobClient.Enqueue <FileAnalysisService>(service =>
                                                                   service.AnalyseEpisodeFiles(episodes.Select(e => e.Id).ToArray(), library.Id));
            }
        }
Ejemplo n.º 17
0
        public async Task <IActionResult> PostUserExperience([FromBody] List <UserExperience> userExperience)
        {
            var users = _context.UserExperience.Where(x => x.UserId == userExperience.FirstOrDefault().UserId);

            _context.RemoveRange(users);
            _context.AddRange(userExperience);
            await _context.SaveChangesAsync();

            return(Ok());
        }
 public void CreateNew(StockElementDTO newStockElements)
 {
     using (var dbContext = new DatabaseContext())
     {
         var stockElements = StockElementFactory.ConvertToEntity(newStockElements);
         stockElements.Select(x => { x.PurchaseDate = DateTime.Now; return(x); }).ToList();
         dbContext.AddRange(stockElements);
         dbContext.SaveChanges();
     }
 }
        public void SeedCustomers(string fileLocation)
        {
            var customers = GetCustomersFromTextFile(fileLocation);

            databaseContext.Customers.RemoveRange(databaseContext.Customers);
            databaseContext.Addresses.RemoveRange(databaseContext.Addresses);
            databaseContext.Relations.RemoveRange(databaseContext.Relations);
            databaseContext.AddRange(customers);

            databaseContext.SaveChanges();
        }
Ejemplo n.º 20
0
        public MockDatabase(params EntityBase[] entities)
        {
            var options =
                new DbContextOptionsBuilder <DatabaseContext>()
                .UseInMemoryDatabase("TestDb").Options;

            _context = new DatabaseContext(options);

            _context.AddRange(entities);

            _context.SaveChanges();
        }
Ejemplo n.º 21
0
        public static void SeedData(DatabaseContext databaseContext)
        {
            if (databaseContext.Customers.Any())
            {
                return;
            }

            var userData  = System.IO.File.ReadAllText("Data/customer-seed.json");
            var customers = JsonConvert.DeserializeObject <List <Customer> >(userData);

            databaseContext.AddRange(customers);
            databaseContext.SaveChanges();
        }
        public async Task ClaimAsync(DatabaseContext context, long userId)
        {
            var rewards = await context.Rewards
                          .Where(o => o.UserId == userId)
                          .AsTracking()
                          .Where(o => o.Claimed == null)
                          .ToListAsync();

            foreach (var reward in rewards)
            {
                reward.Claimed = dateTimeProvider.Now;
                context.AddRange(rewardFactory.Claim(reward).ToList());
            }
        }
        BuildResolver <TResult>(params TResult[] results)
            where TResult : class
        {
            var dbContext = new DatabaseContext <TResult>(_resource);

            dbContext.Database.EnsureCreated();
            dbContext.AddRange(results);
            dbContext.SaveChanges();

            var services = new ServiceCollection();

            services.AddSingleton(dbContext);

            return(services, ctx => ctx.Service <DatabaseContext <TResult> >().Data.AsQueryable());
        }
        private void Seed(DatabaseContext db)
        {
            var dictionaries = new[]
            {
                new Dictionary()
                {
                    Id = 1, Name = "Test1"
                },
                new Dictionary()
                {
                    Id = 2, Name = "Test2"
                },
            };

            db.AddRange(dictionaries);
            db.SaveChanges();
        }
Ejemplo n.º 25
0
 private void AddToIdListDb(List <Tuple <uint, string> > itemsToAdd)
 {
     using (var context = new DatabaseContext())
     {
         //add items that aren't in the VnIdList to the table
         var             idlist = context.VnIdList.Select(x => x.VnId);
         List <VnIdList> vnData = (from item in itemsToAdd
                                   where !idlist.Contains(item.Item1)
                                   select new VnIdList()
         {
             VnId = item.Item1,
             Title = item.Item2
         }).ToList();
         context.AddRange(vnData);
         context.SaveChanges();
     }
 }
        private void Seed(DatabaseContext db)
        {
            var operatorVehicles = new[]
            {
                new OperatorVehicle()
                {
                    Id = 1, OperatorId = 2, VehicleId = 3
                },
                new OperatorVehicle()
                {
                    Id = 2, OperatorId = 2, VehicleId = 3
                },
            };

            db.AddRange(operatorVehicles);
            db.SaveChanges();
        }
        public void GivenNoTaxonomyVocabularyIdAllTaxonomiesAreReturned()
        {
            var taxonomies = EntityHelpers.CreateTaxonomies(3).ToList();

            DatabaseContext.AddRange(taxonomies);
            DatabaseContext.SaveChanges();

            var gatewayResult  = _classUnderTest.GetAllTaxonomies();
            var expectedResult = DatabaseContext.Taxonomies.AsQueryable();

            gatewayResult.Should().NotBeNull();
            gatewayResult.Should().BeEquivalentTo(expectedResult, options =>
            {
                options.Excluding(ex => ex.ServiceTaxonomies);
                return(options);
            });
        }
Ejemplo n.º 28
0
        private void Seed(DatabaseContext db)
        {
            var operatorCities = new[]
            {
                new OperatorCity()
                {
                    Id = 1, CityId = 1, DictionaryId = 1, OperatorContainerId = 1
                },
                new OperatorCity()
                {
                    Id = 2, CityId = 1, DictionaryId = 1, OperatorContainerId = 1
                },
            };

            db.AddRange(operatorCities);
            db.SaveChanges();
        }
Ejemplo n.º 29
0
        private void Seed(DatabaseContext db)
        {
            var vehicles = new[]
            {
                new Vehicle()
                {
                    Id = 1, VehicleNumbers = "RP-1223", YearOfProduction = 2010
                },
                new Vehicle()
                {
                    Id = 2, VehicleNumbers = "21", YearOfProduction = 2012
                },
            };

            db.AddRange(vehicles);
            db.SaveChanges();
        }
        private void Seed(DatabaseContext db)
        {
            var operatorContainers = new[]
            {
                new OperatorContainer()
                {
                    Id = 1, Name = "Test1"
                },
                new OperatorContainer()
                {
                    Id = 2, Name = "Test2"
                },
            };

            db.AddRange(operatorContainers);
            db.SaveChanges();
        }