예제 #1
0
        public async Task <IActionResult> Create([Bind("ArticleID,Date,Title,TeaserText,Image,Text,ExternalLink,ReadmoreLink")] Article article)
        {
            if (ModelState.IsValid)
            {
                _context.Add(article);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(article));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("LandID,Landenavn")] Land land)
        {
            if (ModelState.IsValid)
            {
                _context.Add(land);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(land));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("StadionID,Navn,AttendanceCapacity")] Stadion stadion)
        {
            if (ModelState.IsValid)
            {
                _context.Add(stadion);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(stadion));
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("LigaID,Navn,Logo,LandID")] Liga liga)
        {
            if (ModelState.IsValid)
            {
                _context.Add(liga);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LandID"] = new SelectList(_context.Land, "LandID", "Landenavn", liga.LandID);
            return(View(liga));
        }
예제 #5
0
        public async Task <IActionResult> Create([Bind("SponsorID,Title,SponsorText,Team2ID")] Sponsor sponsor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sponsor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Team2ID"] = new SelectList(_context.Team2s, "Id", "Name", sponsor.Team2ID);
            return(View(sponsor));
        }
예제 #6
0
        public async Task <IActionResult> Create([Bind("Id,Name,Address,StadionID,Seasontickets,Image,Logo,Sponsortext,LigaID")] Team2 team2)
        {
            if (ModelState.IsValid)
            {
                _context.Add(team2);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StadionID"] = new SelectList(_context.Stadion, "StadionID", "Navn", team2.StadionID);
            ViewData["LigaID"]    = new SelectList(_context.Liga, "LigaID", "Navn", team2.LigaID);
            return(View(team2));
        }
예제 #7
0
        public async Task <IActionResult> Create([Bind("Id,Date,HomeTeamId,AwayTeamId,HomeScore,GuestScore,Attendance,Tv,StadionID,LigaID,IsCorona")] Game game)
        {
            if (ModelState.IsValid)
            {
                _context.Add(game);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AwayTeamId"] = new SelectList(_context.Team2s, "Id", "Name", game.AwayTeamId);
            ViewData["HomeTeamId"] = new SelectList(_context.Team2s, "Id", "Name", game.HomeTeamId);
            ViewData["LigaID"]     = new SelectList(_context.Liga, "LigaID", "Navn", game.LigaID);
            ViewData["StadionID"]  = new SelectList(_context.Stadion, "StadionID", "Navn", game.StadionID);
            return(View(game));
        }