Пример #1
0
        public async Task <IActionResult> Edit(long id, [Bind("Descripción,Porcentaje,Id")] Criterio criterio)
        {
            if (id != criterio.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                var criterio1 = (from c in _context.Criterio
                                 where c.Id == id
                                 select c).Include("Rúbrica").FirstOrDefault();
                _context.Entry(criterio1).State = EntityState.Detached;
                try
                {
                    _context.Update(criterio);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CriterioExists(criterio.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Details", "Rúbrica", new { id = criterio1.Rúbrica.Id }));
            }
            return(View(criterio));
        }