Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("CodSeccion,Nombre")] TbSeccion tbSeccion)
        {
            if (id != tbSeccion.CodSeccion)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tbSeccion);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TbSeccionExists(tbSeccion.CodSeccion))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tbSeccion));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("CodSeccion,Nombre")] TbSeccion tbSeccion)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tbSeccion);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tbSeccion));
        }