Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ReporteEppId,Comentarios,Fecha,EppId,EmpleadoId")] ReporteEpp reporteEpp)
        {
            if (id != reporteEpp.ReporteEppId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(reporteEpp);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReporteEppExists(reporteEpp.ReporteEppId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpleadoId"] = new SelectList(_context.Empleados, "EmpleadoId", "EmpleadoId", reporteEpp.EmpleadoId);
            ViewData["EppId"]      = new SelectList(_context.Epps, "EppId", "EppId", reporteEpp.EppId);
            return(View(reporteEpp));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("ReporteEppId,Comentarios,Fecha,EppId,EmpleadoId")] ReporteEpp reporteEpp)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reporteEpp);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpleadoId"] = new SelectList(_context.Empleados, "EmpleadoId", "EmpleadoId", reporteEpp.EmpleadoId);
            ViewData["EppId"]      = new SelectList(_context.Epps, "EppId", "EppId", reporteEpp.EppId);
            return(View(reporteEpp));
        }