예제 #1
0
        public async Task <IActionResult> Edit(string id, [Bind("IdUf,DescUf")] SisUf sisUf)
        {
            if (id != sisUf.IdUf)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sisUf);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SisUfExists(sisUf.IdUf))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sisUf));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("IdUf,DescUf")] SisUf sisUf)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sisUf);
                await _context.SaveChangesAsync();

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