Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,OrganisationId,Name,GameId")] 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)));
            }
            ViewData["GameId"]         = new SelectList(_context.Games, "Id", "Name", team.GameId);
            ViewData["OrganisationId"] = new SelectList(_context.Organisations, "Id", "Name", team.OrganisationId);
            return(View(team));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Country country)
        {
            if (id != country.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(country);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CountryExists(country.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(country));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CountryId,TeamId,Name,Birthdate")] 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["CountryId"] = new SelectList(_context.Countries, "Id", "Name", player.CountryId);
            ViewData["TeamId"]    = new SelectList(_context.Teams, "Id", "Name", player.TeamId);
            return(View(player));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CountryId,CreationDate")] Organisation organisation)
        {
            if (id != organisation.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(organisation);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrganisationExists(organisation.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", "Countries"));
            }
            ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Name", organisation.CountryId);
            return(View(organisation));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,OrganisationId,Name")] Department department)
        {
            if (id != department.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(department);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepartmentExists(department.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrganisationId"] = new SelectList(_context.Organisations, "Id", "Name", department.OrganisationId);
            return(View(department));
        }