public async Task <IActionResult> Edit(int id, [Bind("Id,HomeTeamId,AwayTeamId,DateOfMatch,Referee")] Match match)
        {
            if (id != match.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(match);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MatchExists(match.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AwayTeamId"] = new SelectList(_context.Teams, "Id", "Name", match.AwayTeamId);
            ViewData["HomeTeamId"] = new SelectList(_context.Teams, "Id", "Name", match.HomeTeamId);
            return(View(match));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Sponsor,Television")] Tournament tournament)
        {
            if (id != tournament.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tournament);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TournamentExists(tournament.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tournament));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Town,YearOfFoundation")] Team team)
        {
            if (id != team.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(team);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeamExists(team.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(team));
        }
        public async Task <IActionResult> Edit(int id, [Bind("StudentId,SpolId,Ime,Prezime,SifraStudent,StudentDatum,StudentMjesto,GodinaMajka,GodinaOtac,SportMajka,SportOtac,KojiSportMajka,KojiSportOtac,SportStudent,KojiSportStudent,Trajanje,Istovremeno")] Student student)
        {
            if (id != student.StudentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.StudentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SpolId"] = new SelectList(_context.Spol, "SpolId", "NazivSpola", student.SpolId);
            return(View(student));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,TeamId,FullName,Age")] Player player)
        {
            if (id != player.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(player);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlayerExists(player.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeamId"] = new SelectList(_context.Teams, "Id", "Name", player.TeamId);
            return(View(player));
        }
        public async Task<IActionResult> Edit(int id, [Bind("Id,Name,Capacity,TeamId")] Stadium stadium)
        {
            if (id != stadium.Id)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(stadium);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StadiumExists(stadium.Id))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                return RedirectToAction(nameof(Index));
            }
            ViewData["TeamId"] = new SelectList(_context.Teams, "Id", "Name", stadium.TeamId);
            return View(stadium);
        }
        public async Task <IActionResult> Edit(int id, [Bind("TestiranjeId,StudentId,RazredId,DatumTest")] Testiranje testiranje)
        {
            if (id != testiranje.TestiranjeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(testiranje);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TestiranjeExists(testiranje.TestiranjeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RazredId"]  = new SelectList(_context.Razred, "RazredId", "BrojRazred", testiranje.RazredId);
            ViewData["StudentId"] = new SelectList(_context.Student, "StudentId", "Ime", testiranje.StudentId);
            return(View(testiranje));
        }
        public async Task <IActionResult> Edit(int id, [Bind("NormaId,VrstaTestaId,SpolId,RazredId,Ocjena1,Ocjena2,Ocjena3,Ocjena4,Ocjena5")] Norma norma)
        {
            if (id != norma.NormaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(norma);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NormaExists(norma.NormaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RazredId"]     = new SelectList(_context.Razred, "RazredId", "BrojRazred", norma.RazredId);
            ViewData["SpolId"]       = new SelectList(_context.Spol, "SpolId", "NazivSpola", norma.SpolId);
            ViewData["VrstaTestaId"] = new SelectList(_context.VrstaTesta, "VrstaTestaId", "NazivTesta", norma.VrstaTestaId);
            return(View(norma));
        }
        public async Task <IActionResult> Edit(int id, [Bind("TestId,VrstaTestaId,TestiranjeId,NormaId,TestRezultat,Ocjena")] Test test)
        {
            if (id != test.TestId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(test);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TestExists(test.TestId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["NormaId"]      = new SelectList(_context.Norma, "NormaId", "NormaId", test.NormaId);
            ViewData["TestiranjeId"] = new SelectList(_context.Testiranje, "TestiranjeId", "TestiranjeId", test.TestiranjeId);
            ViewData["VrstaTestaId"] = new SelectList(_context.VrstaTesta, "VrstaTestaId", "VrstaTestaId", test.VrstaTestaId);
            return(View(test));
        }