public async Task <IActionResult> Edit(int id, [Bind("Id,StudentId,CourseId,Marks")] Result result) { if (id != result.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(result); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ResultExists(result.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.Course, "Id", "Id", result.CourseId); ViewData["StudentId"] = new SelectList(_context.Student, "Id", "Id", result.StudentId); return(View(result)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,StudentName,ContactNumber")] 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))); } return(View(student)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CourseName,Credits")] Course course) { if (id != course.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(course); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(course.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(course)); }