Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,SISID,FirstName,LastName,Grade,Notes,TableID")] Student student)
        {
            if (id != student.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TableID"] = new SelectList(_context.Set <Table>(), "ID", "ID", student.TableID);
            return(View(student));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,TableNo,TableGrade,TableCapacity,TableDescription")] Table table)
        {
            if (id != table.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(table);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TableExists(table.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(table));
        }