public async Task <IActionResult> PutEvento([FromRoute] int id, [FromBody] Evento evento)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != evento.id)
            {
                return(BadRequest());
            }

            _context.Entry(evento).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EventoExiste(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "ID,Nombre,Apellido,Dni,Fechanacimiento,Telefono,Enfermedad,Alergia,Sexo,ParroquiaID")] Persona persona)
 {
     if (ModelState.IsValid)
     {
         db.Entry(persona).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(persona));
 }
Beispiel #3
0
 public ActionResult Edit(Evento evento)
 {
     if (ModelState.IsValid)
     {
         db.Entry(evento).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(evento));
 }
Beispiel #4
0
 public ActionResult Editar([Bind(Include = "Id,Titulo,DataInicial,DataFinal,Cor")] Evento evento)
 {
     if (ModelState.IsValid)
     {
         db.Entry(evento).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(evento));
 }
Beispiel #5
0
 public ActionResult Edit([Bind(Include = "ParroquiaID,Nombre")] Parroquia parroquia)
 {
     if (ModelState.IsValid)
     {
         db.Entry(parroquia).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(parroquia));
 }
Beispiel #6
0
 public ActionResult Edit([Bind(Include = "ParticipanteID,EventoID,PersonaID,Puesto,Observacion,Autobus,Pagado,Documentacion")] Participante participante)
 {
     if (ModelState.IsValid)
     {
         db.Entry(participante).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", new { eventoID = participante.EventoID }));
     }
     ViewBag.EventoID  = new SelectList(db.Eventos, "ID", "Nombre", participante.EventoID);
     ViewBag.PersonaID = new SelectList(db.Personas, "ID", "Nombre", participante.PersonaID);
     return(View(participante));
 }
Beispiel #7
0
        public async Task <ActionResult> PutEvento(long id, Evento evento)
        {
            if (id != evento.Id)
            {
                return(BadRequest());
            }

            _context.Entry(evento).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetEvento), new { id = evento.Id }, evento));
        }