public async Task <IActionResult> Edit(int id, Evento evento)
        {
            if (id != evento.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(evento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EventoExists(evento.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(evento));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome")] Departament departament)
        {
            if (id != departament.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(departament);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepartamentExists(departament.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(departament));
        }
Пример #3
0
        public async Task <IActionResult> Edit(string id, [Bind("Nombre,Jornada,Direccion,EscuelaId,Id")] Curso curso)
        {
            if (id != curso.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(curso);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CursoExists(curso.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EscuelaId"] = new SelectList(_context.Set <Escuela>(), "Id", "Id", curso.EscuelaId);
            return(View(curso));
        }
Пример #4
0
 public void Alterar(Curso cursoAlt, Curso novoCurso)
 {
     _storage.Update(PreencherCurso(cursoAlt, novoCurso));
 }