Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("CiiuDivisionID,CiiuSeccionID,Descripcion,Codigo")] CiiuDivision ciiuDivision)
        {
            if (id != ciiuDivision.CiiuDivisionID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ciiuDivision);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CiiuDivisionExists(ciiuDivision.CiiuDivisionID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CiiuSeccionID"] = new SelectList(_context.Set <CiiuSeccion>(), "CiiuSeccionID", "CiiuSeccionID", ciiuDivision.CiiuSeccionID);
            return(View(ciiuDivision));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("CiiuDivisionID,CiiuSeccionID,Descripcion,Codigo")] CiiuDivision ciiuDivision)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ciiuDivision);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CiiuSeccionID"] = new SelectList(_context.Set <CiiuSeccion>(), "CiiuSeccionID", "CiiuSeccionID", ciiuDivision.CiiuSeccionID);
            return(View(ciiuDivision));
        }