public async Task <IActionResult> Edit(Guid id, [Bind("ID,Name")] Career career) { if (id != career.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(career); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CareerExists(career.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(career)); }
public async Task <IActionResult> Edit(Guid id, StudentModel student) { if (id != student.ID) { return(NotFound()); } if (ModelState.IsValid) { var studentTable = new Student() { ID = student.ID, Name = student.Name, CareerID = Guid.Parse(student.CareerID) }; try { _context.Update(studentTable); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentExists(studentTable.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(student)); }
public async Task <IActionResult> Edit(Guid id, [Bind("ID,Name,CareerID")] 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["CareerID"] = new SelectList(_context.Career, "ID", "ID", student.CareerID); return(View(student)); }