public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,BRStudentId,StudentDocTypeId")] BRStudentDoc bRStudentDoc) { if (id != bRStudentDoc.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bRStudentDoc); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BRStudentDocExists(bRStudentDoc.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BRStudentId"] = new SelectList(_context.BRStudent, "Id", "Id", bRStudentDoc.BRStudentId); ViewData["StudentDocTypeId"] = new SelectList(_context.Set <StudentDocType>(), "Id", "Id", bRStudentDoc.StudentDocTypeId); return(View(bRStudentDoc)); }
public async Task <IActionResult> Create([Bind("Id,Name,Description,BRStudentId,StudentDocTypeId")] BRStudentDoc bRStudentDoc) { if (ModelState.IsValid) { _context.Add(bRStudentDoc); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BRStudentId"] = new SelectList(_context.BRStudent, "Id", "Id", bRStudentDoc.BRStudentId); ViewData["StudentDocTypeId"] = new SelectList(_context.Set <StudentDocType>(), "Id", "Id", bRStudentDoc.StudentDocTypeId); return(View(bRStudentDoc)); }