public async Task <IActionResult> Edit(int id, [Bind("Id,Fecha,Calle,Numero,EntreCalles1,EntreCalles2,Descripcion,TipoDenunciaId,EstadoDenunciaId,Legajo,IpDenunciante")] Denuncia denuncia) { if (id != denuncia.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(denuncia); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DenunciaExists(denuncia.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EstadoDenunciaId"] = new SelectList(_context.EstadosDenuncia, "Id", "Id", denuncia.EstadoDenunciaId); ViewData["TipoDenunciaId"] = new SelectList(_context.TiposDenuncia, "Id", "Id", denuncia.TipoDenunciaId); return(View(denuncia)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre")] TipoDenuncia tipoDenuncia) { if (id != tipoDenuncia.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tipoDenuncia); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TipoDenunciaExists(tipoDenuncia.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tipoDenuncia)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Dni,Nombre,Apellido")] Empleado empleado) { if (id != empleado.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(empleado); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmpleadoExists(empleado.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(empleado)); }
public async Task <IActionResult> Create([Bind("Descripcion,DenunciaId,EmpleadoId,EstadoDenunciaId")] Comentario comentario) { if (ModelState.IsValid) { var denuncia = await _context.Denuncias.FindAsync(comentario.DenunciaId); denuncia.EstadoDenunciaId = comentario.EstadoDenunciaId; comentario.FechaCreacion = DateTime.Now; _context.Add(comentario); _context.Update(denuncia); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Denuncias")); } ViewData["DenunciaId"] = new SelectList(_context.Denuncias, "Id", "Id", comentario.DenunciaId); ViewData["EmpleadoId"] = new SelectList(_context.Set <Empleado>(), "Id", "Id", comentario.EmpleadoId); return(View(comentario)); }