예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Ciudad,Nombre")] Certamen certamen)
        {
            if (id != certamen.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(certamen);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CertamenExists(certamen.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(certamen));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,Ciudad,Nombre")] Certamen certamen)
        {
            if (ModelState.IsValid)
            {
                _context.Add(certamen);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(certamen));
        }