Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,TituloProblema,DetalleProblema,QuienReporto,ClienteId,Estado")] ReporteProblema reporteProblema)
        {
            if (id != reporteProblema.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(reporteProblema);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReporteProblemaExists(reporteProblema.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClienteId"] = new SelectList(_context.Cliente, "ID", "ID", reporteProblema.ClienteId);
            return(View(reporteProblema));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("ID,TituloProblema,DetalleProblema,QuienReporto,ClienteId,Estado")] ReporteProblema reporteProblema)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reporteProblema);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClienteId"] = new SelectList(_context.Cliente, "ID", "ID", reporteProblema.ClienteId);
            return(View(reporteProblema));
        }