예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Category category)
        {
            if (id != category.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(category);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategoryExists(category.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Titulo,Descricao,Data,CategoriaId,ComentarioId")] Mensagem mensagem)
        {
            if (id != mensagem.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mensagem);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MensagemExists(mensagem.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoriaId"]  = new SelectList(_context.Categoria, "CategoriaId", "CategoriaId", mensagem.CategoriaId);
            ViewData["ComentarioId"] = new SelectList(_context.Comentario, "ComentarioId", "ComentarioId", mensagem.ComentarioId);
            return(View(mensagem));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,StadiumName,City,NumberTitles,CoachId")] 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["CoachId"] = new SelectList(_context.Coach, "Id", "FullName", team.CoachId);
            return(View(team));
        }
예제 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ComentarioId,Titulo,Descricao,DataDoComentario,Autor")] Comentario comentario)
        {
            if (id != comentario.ComentarioId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(comentario);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ComentarioExists(comentario.ComentarioId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(comentario));
        }
예제 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Price")] Product product)
        {
            if (id != product.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
예제 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,PlayerId,TeamId,Salary,StartingDate,FinishDate")] Contract contract)
        {
            if (id != contract.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contract);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContractExists(contract.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PlayerId"] = new SelectList(_context.Set <Player>(), "Id", "FirstName", contract.PlayerId);
            ViewData["TeamId"]   = new SelectList(_context.Set <Team>(), "Id", "City", contract.TeamId);
            return(View(contract));
        }
예제 #7
0
        public async Task <IActionResult> Edit(string id, [Bind("RollNumber,FirstName,LastName,Phone,Birthday,Gender,Address,CreatedAt,UpdatedAt,Status")] Student student)
        {
            if (id != student.RollNumber)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.RollNumber))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,NumberOfTitles,Country,BirthDate,TeamId")] Coach coach)
        {
            if (id != coach.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(coach);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CoachExists(coach.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeamId"] = new SelectList(_context.Set <Team>(), "Id", "City", coach.TeamId);
            return(View(coach));
        }
예제 #9
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,JerseyNumber,FirstName,LastName,Weight,Height,Position,PrefferedLeg,Goals,Country,BirthDate,ContractId")] 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["ContractId"] = new SelectList(_context.Contract, "Id", "Id", player.ContractId);
            return(View(player));
        }
예제 #10
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,FirstName,LastName,Age,Email,CreatedAt,UpdatedAt,Status")] User user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,ImageName,PlayerId")] Image image)
        {
            if (id != image.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(image);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ImageExists(image.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PlayerId"] = new SelectList(_context.Player, "Id", "FirstName", image.PlayerId);
            return(View(image));
        }