public async Task <IActionResult> Edit(int id, [Bind("Id,TeacherId,accountType,amount")] TeachersAccount teachersAccount) { if (id != teachersAccount.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(teachersAccount); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeachersAccountExists(teachersAccount.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TeacherId"] = new SelectList(_context.Teachers, "Id", "Id", teachersAccount.TeacherId); return(View(teachersAccount)); }
public async Task <IActionResult> Create([Bind("Id,TeacherId,accountType,amount")] TeachersAccount teachersAccount) { if (ModelState.IsValid) { _context.Add(teachersAccount); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TeacherId"] = new SelectList(_context.Teachers, "Id", "Id", teachersAccount.TeacherId); return(View(teachersAccount)); }