コード例 #1
0
        private KeukenhofWebsiteContext GetInMemoryDBMetData()
        {
            KeukenhofWebsiteContext context = GetNewInMemoryDatabase(true);

            context.Add(new Content {
                ContentId = 1, Titel = "Text-Links", Tekst = "hallo ik ben text en ik sta links"
            });
            context.Add(new Content {
                ContentId = 2, Titel = "Titel", Tekst = "Dit is een titel"
            });
            context.Add(new Content {
                ContentId = 3, Titel = "Lezen", Tekst = "Lees Meer"
            });
            context.SaveChanges();
            context = GetNewInMemoryDatabase(false);
            return(context);
        }
コード例 #2
0
ファイル: QenATests.cs プロジェクト: JED-HHS/KeukenhofWebsite
        private KeukenhofWebsiteContext GetInMemoryDBMetData()
        {
            KeukenhofWebsiteContext context = GetNewInMemoryDatabase(true);

            context.Add(new QenA {
                AnswerId = 1, Question = "Welke kleur is blauw?", Answer = "Blauw"
            });
            context.Add(new QenA {
                AnswerId = 2, Question = "Welke kaas is blauw?", Answer = "Red"
            });
            context.Add(new QenA {
                AnswerId = 3, Question = "Welke kleur is Miauw?", Answer = "Miauw"
            });
            context.SaveChanges();
            context = GetNewInMemoryDatabase(false);
            return(context);
        }
コード例 #3
0
        private KeukenhofWebsiteContext GetInMemoryDBMetData()
        {
            KeukenhofWebsiteContext context = GetNewInMemoryDatabase(true);

            context.Add(new Pagina {
                PaginaId = 1, Titel = "Gele Pagina"
            });
            context.Add(new Pagina {
                PaginaId = 2, Titel = "Derde Pagina?"
            });
            context.Add(new Pagina {
                PaginaId = 3, Titel = "Miauw Pagina?"
            });
            context.SaveChanges();
            context = GetNewInMemoryDatabase(false);
            return(context);
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("PaginaId,Titel")] Pagina pagina)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pagina);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pagina));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("Id,PagAction,pagTitle")] Action action)
        {
            if (ModelState.IsValid)
            {
                _context.Add(action);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(action));
        }
コード例 #6
0
        public async Task <IActionResult> Create([Bind("AnswerId,Question,Answer")] QenA qenA)
        {
            if (ModelState.IsValid)
            {
                _context.Add(qenA);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(qenA));
        }
コード例 #7
0
        public async Task <IActionResult> Create([Bind("Naam,Openingsdag,Sluitingsdag,OpeningstijdMaandag,SluitingstijdMaandag,OpeningstijdDinsdag,SluitingstijdDinsdag,OpeningstijdWoensdag,SluitingstijdWoensdag,OpeningstijdDonderdag,SluitingstijdDonderdag,OpeningstijdVrijdag,SluitingstijdVrijdag,OpeningstijdZaterdag,SluitingstijdZaterdag,OpeningstijdZondag,SluitingstijdZondag")] Park park)
        {
            if (ModelState.IsValid)
            {
                _context.Add(park);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(park));
        }
コード例 #8
0
        public async Task <IActionResult> Create([Bind("ContentId,Titel,Tekst")] Content content)
        {
            if (ModelState.IsValid)
            {
                _context.Add(content);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(content));
        }
コード例 #9
0
        public async Task <IActionResult> Create([Bind("AdminId,Username,FirstName,MiddleName,LastName")] Admin admin)
        {
            if (ModelState.IsValid)
            {
                _context.Add(admin);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(admin));
        }
コード例 #10
0
        public async Task <IActionResult> Create([Bind("Id,ZoektermString")] Zoekterm zoekterm)
        {
            if (ModelState.IsValid)
            {
                _context.Add(zoekterm);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(zoekterm));
        }
コード例 #11
0
        public async Task <IActionResult> Create([Bind("ZoektermId,ActionId")] ZoektermAction zoektermAction)
        {
            if (ModelState.IsValid)
            {
                _context.Add(zoektermAction);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ActionId"]   = new SelectList(_context.Action, "Id", "Id", zoektermAction.ActionId);
            ViewData["ZoektermId"] = new SelectList(_context.Zoekterm, "Id", "Id", zoektermAction.ZoektermId);
            return(View(zoektermAction));
        }