Пример #1
0
        public IHttpActionResult Put([FromBody] SubthemeDto dto)
        {
            Subtheme entity = ModelMapper.Map <Subtheme>(dto);

            this.subthemes.Change(entity);
            return(Ok());
        }
        private async Task AddOrUpdateSet(string apiKey, Theme theme, Subtheme subtheme, Sets bricksetSet, short?year = null)
        {
            _messageHub.Publish(new SynchronizingSetStart {
                Theme = theme.Name, Subtheme = subtheme?.Name, Name = bricksetSet.Name, Number = bricksetSet.Number, NumberVariant = bricksetSet.NumberVariant, Year = year
            });

            try
            {
                var set = await MapSet(apiKey, theme, subtheme, bricksetSet);

                _setRepository.AddOrUpdate(set);

                await _thumbnailSynchronizer.Synchronize(set, true);
            }
            catch (Exception ex)
            {
                _messageHub.Publish(new SynchronizingSetException {
                    Theme = theme.Name, Subtheme = subtheme?.Name, Name = bricksetSet.Name, Number = bricksetSet.Number, NumberVariant = bricksetSet.NumberVariant, Exception = ex
                });
            }

            _messageHub.Publish(new SynchronizingSetEnd {
                Theme = theme.Name, Subtheme = subtheme?.Name, Name = bricksetSet.Name, Number = bricksetSet.Number, NumberVariant = bricksetSet.NumberVariant
            });
        }
Пример #3
0
        public IHttpActionResult Get(int id)
        {
            Subtheme    entity = this.subthemes.Get(id);
            SubthemeDto dto    = ModelMapper.Map <SubthemeDto>(entity);

            return(Ok(dto));
        }
Пример #4
0
        public Subtheme AddOrUpdate(Subtheme subtheme)
        {
            if (subtheme is null ||
                subtheme.Theme is null ||
                string.IsNullOrWhiteSpace(subtheme.Theme.Name) ||
                subtheme.YearFrom < Constants.MinimumSetYear ||
                subtheme.Theme.YearFrom < Constants.MinimumSetYear)

            {
                return(null);
            }

            if (string.IsNullOrWhiteSpace(subtheme.Name))
            {
                subtheme.Name = "{None}";
            }

            subtheme.TrimAllStrings();

            using var repository = _repositoryService.GetRepository();

            repository.Upsert(subtheme);

            return(subtheme);
        }
        public async Task SynchronizeForRecentlyUpdated_BricksetApiServiceReturnsListOfSets_AllSetsAreSaved()
        {
            var themesList = JsonConvert.DeserializeObject <List <Themes> >(GetResultFileFromResource(Constants.JsonFileGetThemes));
            var testTheme  = themesList.First(themes => themes.Theme == Constants.TestThemeArchitecture);
            var theme      = testTheme.ToTheme();
            var recentlyUpdatedSetsList = JsonConvert.DeserializeObject <List <Sets> >(GetResultFileFromResource(Constants.JsonFileGetRecentlyUpdatedSets));

            _themeRepository.AddOrUpdate(theme);

            var subtheme = new Subtheme
            {
                Name     = "",
                Theme    = theme,
                YearFrom = theme.YearFrom,
                YearTo   = theme.YearTo
            };

            _subthemeRepository.AddOrUpdate(subtheme);

            var bricksetApiService = Substitute.For <IBricksetApiService>();

            bricksetApiService
            .GetSets(Arg.Any <GetSetsParameters>())
            .Returns(recentlyUpdatedSetsList);

            var setSynchronizer = CreateTarget(bricksetApiService);

            await setSynchronizer.Synchronize(string.Empty, DateTimeOffset.Now).ConfigureAwait(false);

            Check.That(_setRepository.All()).CountIs(recentlyUpdatedSetsList.Count);
        }
        public void AddOrUpdate_NullSubtheme_ReturnsNull()
        {
            Subtheme subthemeUnderTest = null;

            var subtheme = _subthemeRepository.AddOrUpdate(subthemeUnderTest);

            Check.That(subtheme).IsNull();
        }
Пример #7
0
        public IHttpActionResult Post([FromBody] SubthemeDto dto)
        {
            Subtheme entity = ModelMapper.Map <Subtheme>(dto);

            this.subthemes.Add(entity);
            dto = ModelMapper.Map <SubthemeDto>(entity);
            return(Ok(dto));
        }
        public void AddOrUpdate_InvalidSubtheme_ReturnsNull(string subthemeName)
        {
            var subthemeUnderTest = new Subtheme {
                Name = subthemeName
            };

            var subtheme = _subthemeRepository.AddOrUpdate(subthemeUnderTest);

            Check.That(subtheme).IsNull();
        }
        public void AddOrUpdate_NullTheme_ReturnsNull()
        {
            var subthemeUnderTest = new Subtheme {
                Name = ModelsSetup.NonExistentSubthemeName
            };

            var subtheme = _subthemeRepository.AddOrUpdate(subthemeUnderTest);

            Check.That(subtheme).IsNull();
        }
Пример #10
0
        public void ShouldDelete()
        {
            Subtheme subtheme = new Subtheme("shouldbedeleted", this.organisation.Id, this.theme.Id);

            subtheme = this.subthemes.Create(subtheme);

            this.subthemes.Delete(subtheme.Id);

            subtheme = this.subthemes.Read(subtheme.Id);

            Assert.Null(subtheme);
        }
Пример #11
0
        public void ShouldReadSingleOrganisationWithoutCollections()
        {
            int[] ids = { this.subtheme.Id, 1 };

            foreach (int id in ids)
            {
                Subtheme subtheme = this.subthemes.Read(this.subtheme.Id, eager: false);

                Assert.Null(subtheme.SelectionCards);
                Assert.Null(subtheme.Sessions);
            }
        }
Пример #12
0
        public void ShouldUpdate()
        {
            this.subtheme = this.subthemes.Read(this.subtheme.Id);

            string name = "updatedname";

            this.subtheme.Name = name;

            this.subthemes.Update(subtheme);
            this.subtheme = this.subthemes.Read(this.subtheme.Id);

            Assert.AreEqual(this.subtheme.Name, name);
        }
Пример #13
0
        public void SetUp()
        {
            FakeContext context = new FakeContext();

            this.organisations = new OrganisationRepository(context);
            this.subthemes     = new SubthemeRepository(context);
            this.themes        = new ThemeRepository(context);

            // all other objects than 'subtheme' are available thanks to a migration test database seed
            this.organisation = this.organisations.Read(1);
            this.theme        = this.themes.Read(1);

            this.subtheme = new Subtheme("NUnitMasterRace", this.organisation.Id, this.theme.Id);
            this.subtheme = this.subthemes.Create(subtheme);
        }
Пример #14
0
        public void SetUp()
        {
            FakeContext context = new FakeContext();

            this.organisations = new OrganisationRepository(context);
            this.sessions      = new SessionRepository(context);
            this.subthemes     = new SubthemeRepository(context);

            // all other objects than 'session' are available thanks to a migration test database seed
            this.organisation = this.organisations.Read(1);
            this.subtheme     = this.subthemes.Read(1);

            this.session = new Session(true, 0, "NUnitMasterRace", false, 10, 10, this.organisation.Id, 1, this.subtheme.Id, DateTime.Now, DateTime.Now.AddDays(2));
            this.session = this.sessions.Create(session);
        }
        private async Task <Set> MapSet(string apiKey, Theme theme, Subtheme subtheme, Sets bricksetSet)
        {
            var set = bricksetSet.ToSet();

            set.Theme         = theme;
            set.Subtheme      = subtheme;
            set.Category      = _referenceDataRepository.GetOrAdd <Category>(bricksetSet.Category);
            set.PackagingType = _referenceDataRepository.GetOrAdd <PackagingType>(bricksetSet.PackagingType);
            set.ThemeGroup    = _referenceDataRepository.GetOrAdd <ThemeGroup>(bricksetSet.ThemeGroup);

            SetTagList(set, bricksetSet.ExtendedData?.Tags);
            SetPriceList(set, bricksetSet.LegoCom);

            await SetImageList(apiKey, set, bricksetSet);
            await SetInstructionList(apiKey, set, bricksetSet);

            return(set);
        }
        public async Task Synchronize(string apiKey, Theme theme, Subtheme subtheme)
        {
            _messageHub.Publish(new SetSynchronizerStart {
                ForSubtheme = true
            });

            for (var year = subtheme.YearFrom; year <= subtheme.YearTo; year++)
            {
                try
                {
                    _messageHub.Publish(new AcquiringSetsStart {
                        Theme = theme.Name, Subtheme = subtheme.Name, Year = year
                    });

                    var getSetsParameters = new GetSetsParameters
                    {
                        Theme    = theme.Name,
                        Subtheme = subtheme.Name.Replace("{None}", ""),
                        Year     = year
                    };

                    var bricksetSets = await GetAllSetsFor(apiKey, getSetsParameters);

                    _messageHub.Publish(new AcquiringSetsEnd {
                        Theme = theme.Name, Subtheme = subtheme.Name, Count = bricksetSets.Count, Year = year
                    });

                    foreach (var bricksetSet in bricksetSets)
                    {
                        await AddOrUpdateSet(apiKey, theme, subtheme, bricksetSet, year);
                    }
                }
                catch (Exception ex)
                {
                    _messageHub.Publish(new SetSynchronizerException {
                        Exception = ex
                    });
                }
            }

            _messageHub.Publish(new SetSynchronizerEnd {
                ForSubtheme = true
            });
        }
        private void AuthorizePut(HttpActionContext actionContext)
        {
            int organiserId;

            string controller = actionContext.ControllerContext.ControllerDescriptor.ControllerName;

            switch (controller)
            {
            case "Organisation":
                OrganisationDto organisationDto = (OrganisationDto)actionContext.ActionArguments["dto"];
                Organisation    organisation    = this.Organisations.Get(organisationDto.Id);
                organiserId = organisation.OrganiserId;
                break;

            case "Subtheme":
                SubthemeDto subthemeDto = (SubthemeDto)actionContext.ActionArguments["dto"];
                Subtheme    subtheme    = this.Subthemes.Get(subthemeDto.Id);
                organiserId = subtheme.OrganiserId;
                break;

            case "Theme":
                ThemeDto themeDto = (ThemeDto)actionContext.ActionArguments["dto"];
                Theme    theme    = this.Themes.Get(themeDto.Id);
                organiserId = themeDto.OrganiserId;
                break;

            case "Session":
                SessionDto sessionDto = (SessionDto)actionContext.ActionArguments["dto"];
                Session    session    = this.Sessions.Get(sessionDto.Id, collections: true);

                this.AuthorizeOrganiser(session.Organisers);

                return;

            default:        // will be unauthorized
                organiserId = -1;
                break;
            }

            this.AuthorizeOrganiser(organiserId);
        }
        private void AuthorizePost(HttpActionContext actionContext)
        {
            int organiserId;

            string controller = actionContext.ControllerContext.ControllerDescriptor.ControllerName;

            switch (controller)
            {
            case "Session":
            {
                SessionDto sessionDto = (SessionDto)actionContext.ActionArguments["dto"];
                Subtheme   subtheme   = this.Subthemes.Get(sessionDto.SubthemeId);
                organiserId = subtheme.OrganiserId;
            }
            break;

            case "Subtheme":
            {
                SubthemeDto subthemeDto = (SubthemeDto)actionContext.ActionArguments["dto"];
                Theme       theme       = this.Themes.Get(subthemeDto.ThemeId);
                organiserId = theme.OrganiserId;
            }
            break;

            case "Theme":
            {
                ThemeDto     themeDto     = (ThemeDto)actionContext.ActionArguments["dto"];
                Organisation organisation = this.Organisations.Get(themeDto.OrganisationId);
                organiserId = organisation.OrganiserId;
            }
            break;

            default:        // to prevent the dto from being null
                organiserId = -1;
                break;
            }

            this.AuthorizeOrganiser(organiserId);
        }
Пример #19
0
        private string GetParams()
        {
            dynamic @params = new JObject();

            if (SetId.HasValue)
            {
                @params.setID = SetId.Value;
            }

            if (!string.IsNullOrWhiteSpace(Query))
            {
                @params.query = Query.Trim();
            }

            if (!string.IsNullOrWhiteSpace(Theme))
            {
                @params.theme = Theme.Trim();
            }

            if (!string.IsNullOrWhiteSpace(Subtheme))
            {
                @params.subtheme = Subtheme.Trim();
            }

            if (!string.IsNullOrWhiteSpace(SetNumber))
            {
                @params.setNumber = SetNumber.Trim();
            }

            if (Year.HasValue)
            {
                @params.year = Year.Value.ToString();
            }

            if (!string.IsNullOrWhiteSpace(Tag))
            {
                @params.tag = Tag.Trim();
            }

            if (Owned.HasValue)
            {
                @params.owned = Owned.Value ? 1 : 0;
            }

            if (Wanted.HasValue)
            {
                @params.wanted = Wanted.Value ? 1 : 0;
            }

            if (UpdatedSince.HasValue)
            {
                @params.updatedSince = UpdatedSince.Value.ToString("yyyy-MM-dd HH:mm:ss");
            }

            if (!string.IsNullOrWhiteSpace(OrderBy))
            {
                @params.orderBy = OrderBy.Trim();
            }

            if (PageSize.HasValue)
            {
                @params.pageSize = PageSize.Value;
            }

            if (PageNumber.HasValue)
            {
                @params.pageNumber = PageNumber.Value;
            }

            if (ExtendedData.HasValue)
            {
                @params.extendedData = ExtendedData.Value ? 1 : 0;
            }

            return(@params.ToString());
        }
Пример #20
0
        public void OneTimeSetUp()
        {
            this.accounts      = FakeServiceFactory.Create <Account>();
            this.organisations = FakeServiceFactory.Create <Organisation>();
            this.sessions      = FakeServiceFactory.Create <Session>();
            this.subthemes     = FakeServiceFactory.Create <Subtheme>();
            this.themes        = FakeServiceFactory.Create <Theme>();

            this.unauthorized = "unauthorizedusersecret";
            this.authorized   = "authorizedusersecret";

            Account account1 = new Account("*****@*****.**", "name1", "surname1", "picture1", this.authorized)
            {
                Organisations     = new List <Organisation>(),
                OrganisedSessions = new List <Session>(),
                Subthemes         = new List <Subtheme>(),
                Themes            = new List <Theme>()
            };

            account1 = this.accounts.Add(account1);
            Account account2 = new Account("*****@*****.**", "name2", "surname2", "picture2", this.unauthorized);

            account2 = this.accounts.Add(account2);

            Organisation organisation = new Organisation("name", account1.Id)
            {
                Sessions = new List <Session>(),
                Themes   = new List <Theme>()
            };

            organisation = this.organisations.Add(organisation);
            account1.Organisations.Add(organisation);
            this.accounts.Change(account1);

            Theme theme = new Theme("name", "descr", organisation.Id, organisation.OrganiserId, "tag")
            {
                Subthemes = new List <Subtheme>()
            };

            theme = this.themes.Add(theme);
            organisation.Themes.Add(theme);
            this.organisations.Change(organisation);
            account1.Themes.Add(theme);
            this.accounts.Change(account1);

            Subtheme subtheme = new Subtheme("name", theme.OrganiserId, theme.Id)
            {
                Sessions = new List <Session>()
            };

            subtheme = this.subthemes.Add(subtheme);
            theme.Subthemes.Add(subtheme);
            this.themes.Change(theme);
            account1.Subthemes.Add(subtheme);
            this.accounts.Change(account1);

            Session session = new Session(true, 0, "descr", false, 10, 10, organisation.Id, 0, subtheme.Id, DateTime.Now, DateTime.Now.AddDays(5))
            {
                Organisers = new List <Account>()
            };

            session = this.sessions.Add(session);
            subtheme.Sessions.Add(session);
            this.subthemes.Change(subtheme);
            account1.OrganisedSessions.Add(session);
            session.Organisers.Add(account1);
            this.accounts.Change(account1);
            this.sessions.Change(session);
        }
Пример #21
0
        /// <summary>
        /// Добавление подтемы и создание связи - многие ко многим
        /// </summary>
        /// <param name="ach"></param>
       void CreateManyToManyRel(AchievmentsEntities ach)
        {
            //выбор темы из бд
            Theme th = ach.Themes.Where(x => x.Name == ComboBoxTheme.SelectedValue.ToString()).FirstOrDefault();
             
           Subtheme st;

           //Если подтема есть, связать её еще одной темой
           if (ach.Subthemes.Select(t => t.Name.ToUpper().Equals(TextBoxName.Text.ToUpper())).FirstOrDefault())
               st = ach.Subthemes.Where(t => t.Name == TextBoxName.Text).FirstOrDefault();
           //если нет - создать новую
           else
           {
               st = new Subtheme() { Name = TextBoxName.Text };
               ach.Subthemes.Add(st);
           }
           
            

            //добавление связи к теме 
            ach.SubThemeRels.Add(
                new SubThemeRel() 
            { 
                Theme=th,
                Subtheme=st
            }
                );
            

            
            ach.SaveChanges();
        }
Пример #22
0
 void CreateAchList(Subtheme sTh)
 {
     AchievmentsEntities ach = new AchievmentsEntities();
     achI.AddRange(ach.AchieveInfoes.Where(p => p.SubthemeID == sTh.ID && p.PersonID == App.curPnID).AsEnumerable());
 }
Пример #23
0
        protected override void Seed(Context context)
        {
            int accountId = 0;
            //int chatmessageId = 0;
            int sessionId       = 0;
            int themeId         = 0;
            int subthemeId      = 0;
            int selectionCardId = 0;
            int sessionCardId   = 0;
            int organisationId  = 0;

            #region AccountSeed
            Account account = new Account("*****@*****.**", "Thomas", "Van Deun", "http://i.imgur.com/SNoEbli.png", "auth0|56d4591317aca91f1aff5dfb");
            account.Id = ++accountId;
            context.Accounts.AddOrUpdate(account);

            //acc = new Account("*****@*****.**", "Michelle", "Beckers", "picture", "", "michelle13245");
            //context.Accounts.AddOrUpdate(acc);

            //acc = new Account("*****@*****.**", "Olivier", "Van Aken", "picture", "", "oli12345");
            //context.Accounts.AddOrUpdate(acc);

            account    = new Account("*****@*****.**", "Bennie", "Bax", "http://i.imgur.com/SNoEbli.png", "google-oauth2|104916923787165182658");
            account.Id = ++accountId;
            context.Accounts.AddOrUpdate(account);

            //acc = new Account("*****@*****.**", "Joachim", "De Schryver", "picture", "", "joa2345");
            //context.Accounts.AddOrUpdate(acc);

            account    = new Account("*****@*****.**", "Cas", "Decelle", "http://i.imgur.com/SNoEbli.png", "auth0|56d49e6d6568e621399e379c");
            account.Id = ++accountId;
            context.Accounts.AddOrUpdate(account);

            account    = new Account("*****@*****.**", "Cas", "Decelle", "http://i.imgur.com/SNoEbli.png", "google-oauth2|112196091859139010399");
            account.Id = ++accountId;
            context.Accounts.AddOrUpdate(account);

            account    = new Account("*****@*****.**", "test", "hihi", "http://i.imgur.com/SNoEbli.png", "auth0|56d32ffb17aca91f1aff4493");
            account.Id = ++accountId;
            context.Accounts.AddOrUpdate(account);


            context.SaveChanges();
            #endregion

            #region Organisations
            Organisation organisation = new Organisation("Jeugd", 1);
            organisation.Id = ++organisationId;
            context.Organisations.AddOrUpdate(organisation);

            organisation    = new Organisation("OCMW", 2);
            organisation.Id = ++organisationId;
            context.Organisations.AddOrUpdate(organisation);

            organisation    = new Organisation("Overheid", 3);
            organisation.Id = ++organisationId;
            context.Organisations.AddOrUpdate(organisation);

            context.SaveChanges();
            #endregion

            #region ThemeSeed
            String tags = "jeugd;werken;geld";

            Theme theme = new Theme("Jongerenwerking", "Hoe laten we de jeugd terug werken", 1, 1, tags);
            theme.Id = ++themeId;
            context.Themes.AddOrUpdate(theme);

            tags = "feest;fuiven";

            theme    = new Theme("Feest", "Organiseren van fuiven", 1, 1, tags);
            theme.Id = ++themeId;
            context.Themes.AddOrUpdate(theme);

            tags = "toekomst;werken;geld";

            theme    = new Theme("Armoedebestrijding", "Hoe kunnen we iedereen rijk maken", 2, 2, tags);
            theme.Id = ++themeId;
            context.Themes.AddOrUpdate(theme);

            tags = "geld";

            theme    = new Theme("Financien", "Hoe om gaan met geld", 3, 3, tags);
            theme.Id = ++themeId;
            context.Themes.AddOrUpdate(theme);

            tags = "geld";

            theme    = new Theme("Politiek", "Politieke ideeen", 3, 3, tags);
            theme.Id = ++themeId;
            context.Themes.AddOrUpdate(theme);

            tags = "geld";

            theme    = new Theme("Pesten", "Stop het pesten!", 3, 3, tags);
            theme.Id = ++themeId;
            context.Themes.AddOrUpdate(theme);

            context.SaveChanges();
            #endregion

            #region Subtheme
            Subtheme subtheme = new Subtheme("Vakantiejobs", 1, 1);
            subtheme.Id = ++subthemeId;
            context.Subthemes.AddOrUpdate(subtheme);

            subtheme    = new Subtheme("Speelplein", 1, 1);
            subtheme.Id = ++subthemeId;
            context.Subthemes.AddOrUpdate(subtheme);

            subtheme    = new Subtheme("Feest in jeugdhuis", 1, 2);
            subtheme.Id = ++subthemeId;
            context.Subthemes.AddOrUpdate(subtheme);

            subtheme    = new Subtheme("Help de armen!", 2, 3);
            subtheme.Id = ++subthemeId;
            context.Subthemes.AddOrUpdate(subtheme);

            subtheme    = new Subtheme("Democratie", 3, 5);
            subtheme.Id = ++subthemeId;
            context.Subthemes.AddOrUpdate(subtheme);

            subtheme    = new Subtheme("Verkiezingen", 3, 5);
            subtheme.Id = ++subthemeId;
            context.Subthemes.AddOrUpdate(subtheme);

            subtheme    = new Subtheme("Tip voor pesten tegen te gaan", 3, 6);
            subtheme.Id = ++subthemeId;
            context.Subthemes.AddOrUpdate(subtheme);

            context.SaveChanges();
            #endregion

            #region SessionSeed
            Session session = new Session(true, 1, "session1", true, 3, 8, 1, 0, 1, DateTime.Now, DateTime.Today);
            session.Id = ++sessionId;
            context.Sessions.AddOrUpdate(session);

            session    = new Session(true, 1, "session2", false, 3, 8, 1, 0, 2, DateTime.Now, DateTime.Today);
            session.Id = ++sessionId;
            context.Sessions.AddOrUpdate(session);

            session    = new Session(true, 1, "session3", false, 3, 8, 1, 0, 2, DateTime.Now.AddDays(2), DateTime.Today);
            session.Id = ++sessionId;
            context.Sessions.AddOrUpdate(session);

            session    = new Session(false, 2, "session4", true, 3, 8, 1, 0, 3, DateTime.Now, DateTime.Today);
            session.Id = ++sessionId;
            context.Sessions.AddOrUpdate(session);

            session    = new Session(false, 3, "session5", false, 3, 8, 2, 0, 4, DateTime.Now.AddDays(10), DateTime.Today);
            session.Id = ++sessionId;
            context.Sessions.AddOrUpdate(session);

            session    = new Session(false, 3, "session6", false, 3, 8, 3, 0, 7, DateTime.Now.AddDays(8), DateTime.Today);
            session.Id = ++sessionId;
            context.Sessions.AddOrUpdate(session);

            session    = new Session(false, 3, "session7", false, 3, 8, 3, 0, 7, DateTime.Now, DateTime.Today);
            session.Id = ++sessionId;
            context.Sessions.AddOrUpdate(session);

            session    = new Session(true, 1, "session8", false, 3, 8, 3, 0, 7, DateTime.Now, DateTime.Today);
            session.Id = ++sessionId;
            context.Sessions.AddOrUpdate(session);

            //bool cardCreationAllowed,int currentPlayerIndex, bool isFinished, int maxCardsToChoose, int maxParticipants, Modus modus, int organisationId, int round, int subthemeId, DateTime start, DateTime end
            session    = new Session(true, 3, "session9", false, 3, 6, 3, 0, 7, DateTime.Now.AddDays(-4), DateTime.Today.AddDays(-1));
            session.Id = ++sessionId;
            context.Sessions.AddOrUpdate(session);

            context.SaveChanges();
            #endregion

            #region ChatmsgSeed
            ////SESSION 1
            //ChatMessage chatmessage = new ChatMessage(1, 1, "hoi", DateTime.Today.AddDays(-2));
            //chatmessage.Id = ++chatmessageId;
            //context.ChatMessages.AddOrUpdate(chatmessage);

            //chatmessage = new ChatMessage(2, 1, "hey", DateTime.Today.AddDays(-1));
            //chatmessage.Id = ++chatmessageId;
            //context.ChatMessages.AddOrUpdate(chatmessage);

            //chatmessage = new ChatMessage(1, 1, "hihi", DateTime.Today.AddDays(-1));
            //chatmessage.Id = ++chatmessageId;
            //context.ChatMessages.AddOrUpdate(chatmessage);

            ////SESSION 2
            //chatmessage = new ChatMessage(1, 2, "Dit", DateTime.Now);
            //chatmessage.Id = ++chatmessageId;
            //context.ChatMessages.AddOrUpdate(chatmessage);

            //chatmessage = new ChatMessage(2, 2, "is", DateTime.Now);
            //chatmessage.Id = ++chatmessageId;
            //context.ChatMessages.AddOrUpdate(chatmessage);

            //chatmessage = new ChatMessage(4, 2, "een", DateTime.Now);
            //chatmessage.Id = ++chatmessageId;
            //context.ChatMessages.AddOrUpdate(chatmessage);

            //chatmessage = new ChatMessage(5, 2, "chatmessage", DateTime.Now);
            //chatmessage.Id = ++chatmessageId;
            //context.ChatMessages.AddOrUpdate(chatmessage);

            ////SESSION 4
            //chatmessage = new ChatMessage(1, 4, "Kandoe is top !", DateTime.Now);
            //chatmessage.Id = ++chatmessageId;
            //context.ChatMessages.AddOrUpdate(chatmessage);

            //chatmessage = new ChatMessage(2, 4, "joepiee", DateTime.Now);
            //chatmessage.Id = ++chatmessageId;
            //context.ChatMessages.AddOrUpdate(chatmessage);

            //chatmessage = new ChatMessage(3, 4, "hoi allemaal", DateTime.Now);
            //chatmessage.Id = ++chatmessageId;
            //context.ChatMessages.AddOrUpdate(chatmessage);

            ////SESSION 5
            //chatmessage = new ChatMessage(1, 5, "Testje", DateTime.Now);
            //chatmessage.Id = ++chatmessageId;
            //context.ChatMessages.AddOrUpdate(chatmessage);

            //chatmessage = new ChatMessage(5, 5, "lalalallaa", DateTime.Now);
            //chatmessage.Id = ++chatmessageId;
            //context.ChatMessages.AddOrUpdate(chatmessage);

            //context.SaveChanges();

            #endregion

            #region SelectionCardSeed
            //THEMA 1
            SelectionCard selectionCard = new SelectionCard("testImage", "Toneel", 1);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            //SUBTHEMA 1
            selectionCard    = new SelectionCard("testImage", "Flexibele uren", 1, 1);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Toffe collega's ", 1, 1);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Minumumloon", 1, 1);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Uren/week", 1, 1);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Zomerjob", 1, 1);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            //SUBTHEMA 2
            selectionCard    = new SelectionCard("testImage", "Opvang", 1, 2);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Sport", 1, 2);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Vrijwilligerswerk", 1, 2);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Kinderen < 12", 1, 2);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Kinderen > 12", 1, 2);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Locatie", 1, 2);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            //THEMA 2
            selectionCard    = new SelectionCard("testImage", "Goede locatie", 2);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Grote capaciteit", 2);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            //SUBTHEMA 3
            selectionCard    = new SelectionCard("testImage", "Vestiare", 2, 3);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Cocktailbar", 2, 3);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Goede muziekinstallatie", 2, 3);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Lichten", 2, 3);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Minimumleeftijd", 1, 3);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Einduur", 1, 3);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            //THEMA 3
            //SUBTHEMA 4
            selectionCard    = new SelectionCard("testImage", "Voedselbank", 3, 4);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Kledingverzamelactie", 3, 4);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Opvangcentra", 3, 4);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Dekens uitdelen", 3, 4);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Geld geven", 3, 4);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            //THEMA 4
            selectionCard    = new SelectionCard("testImage", "Begroting", 4);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Kamer van koophandel", 4);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            //THEMA 5
            selectionCard    = new SelectionCard("testImage", "Debat", 5);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Eerste minister", 5);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);


            //SUBTHEMA 5
            selectionCard    = new SelectionCard("testImage", "President", 5, 5);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Koning", 5, 5);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            //SUBTHEMA 6
            selectionCard    = new SelectionCard("testImage", "Groen", 5, 6);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "SPA", 5, 6);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Vlaams belang", 5, 6);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "CD&V", 5, 6);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "MR", 5, 6);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);



            //THEMA 6
            selectionCard    = new SelectionCard("testImage", "Pesters", 6);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Slachtoffers", 6);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            //SUBTHEMA 7
            selectionCard    = new SelectionCard("testImage", "Campagnes", 6, 7);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Anti-pesten helpnummer", 6, 7);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Anonieme helpchat", 6, 7);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Website", 6, 7);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);

            selectionCard    = new SelectionCard("testImage", "Gesprekken op school", 6, 7);
            selectionCard.Id = ++selectionCardId;
            context.SelectionCards.AddOrUpdate(selectionCard);


            context.SaveChanges();
            #endregion

            #region SesssionCardSeed
            //Cards SESSION 1
            SessionCard sessionCard = new SessionCard("testImage", 1, "Flexibele uren");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 1, "Toffe collega's ");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 1, "Uren/week");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 1, "Zomerjob");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 1, "Horeca");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            //Cards SESSION 2
            sessionCard    = new SessionCard("testImage", 2, "Opvang");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 2, "Vrijwilligerswerk");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 2, "Kinderen < 12");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 2, "Kinderen > 12");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 2, "Locatie");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            //Cards SESSION 3
            sessionCard    = new SessionCard("testImage", 3, "Opvang");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 3, "Kinderen < 12");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 3, "Kinderen > 12");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);


            //Cards SESSION 4
            sessionCard    = new SessionCard("testImage", 4, "Vestiare");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 4, "Cocktailbar");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 4, "Goede muziekinstallatie");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 4, "Lichten");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            //Cards SESSION 5
            sessionCard    = new SessionCard("testImage", 5, "Voedselbank");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 5, "Opvangcentra");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 5, "Kledingverzamelactie");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            //Cards SESSION 6
            sessionCard    = new SessionCard("testImage", 6, "Campagnes");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 6, "Anonieme helpchat");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 6, "Anti-pesten helpnummer");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 6, "Website");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            //Cards SESSION 7
            sessionCard    = new SessionCard("testImage", 7, "Gesprekken op school");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 7, "Anti-pesten helpnummer");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 7, "Campagnes");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 7, "Website");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            sessionCard    = new SessionCard("testImage", 7, "Anonieme helpchat");
            sessionCard.Id = ++sessionCardId;
            context.SessionCards.AddOrUpdate(sessionCard);

            context.SaveChanges();
            #endregion

            // seed
            base.Seed(context);
        }