Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Consecutivointerna,Idcontactoremitente,Idcontactodestinatario,Fecha,Radicadointerna")] Correspondeciainterna correspondeciainterna)
        {
            if (id != correspondeciainterna.Consecutivointerna)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(correspondeciainterna);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CorrespondeciainternaExists(correspondeciainterna.Consecutivointerna))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Idcontactodestinatario"] = new SelectList(_context.Contactos, "Idcontacto", "Idcontacto", correspondeciainterna.Idcontactodestinatario);
            ViewData["Idcontactoremitente"]    = new SelectList(_context.Contactos, "Idcontacto", "Idcontacto", correspondeciainterna.Idcontactoremitente);
            return(View(correspondeciainterna));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Consecutivointerna,Idcontactoremitente,Idcontactodestinatario,Fecha,Radicadointerna")] Correspondeciainterna correspondeciainterna)
        {
            if (ModelState.IsValid)
            {
                _context.Add(correspondeciainterna);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Idcontactodestinatario"] = new SelectList(_context.Contactos, "Idcontacto", "Idcontacto", correspondeciainterna.Idcontactodestinatario);
            ViewData["Idcontactoremitente"]    = new SelectList(_context.Contactos, "Idcontacto", "Idcontacto", correspondeciainterna.Idcontactoremitente);
            return(View(correspondeciainterna));
        }