Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Número,Fecha,Nota,Porcentaje,EstudianteKId,CursoKId")] ParcialK parcialK)
        {
            if (id != parcialK.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(parcialK);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ParcialKExists(parcialK.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CursoKId"]      = new SelectList(_context.CursoK, "Id", "Profesor", parcialK.CursoKId);
            ViewData["EstudianteKId"] = new SelectList(_context.EstudianteK, "Id", "Email", parcialK.EstudianteKId);
            return(View(parcialK));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,Número,Fecha,Nota,Porcentaje,EstudianteKId,CursoKId")] ParcialK parcialK)
        {
            if (ModelState.IsValid)
            {
                _context.Add(parcialK);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CursoKId"]      = new SelectList(_context.CursoK, "Id", "Profesor", parcialK.CursoKId);
            ViewData["EstudianteKId"] = new SelectList(_context.EstudianteK, "Id", "Email", parcialK.EstudianteKId);
            return(View(parcialK));
        }