public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Icon,Url,DoctorId")] DoctorTeamLink doctorTeamLink) { if (id != doctorTeamLink.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(doctorTeamLink); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DoctorTeamLinkExists(doctorTeamLink.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DoctorId"] = new SelectList(_context.Doctors, "Id", "Id", doctorTeamLink.DoctorId); return(View(doctorTeamLink)); }
public async Task <IActionResult> Create([Bind("Id,Name,Icon,Url,DoctorId")] DoctorTeamLink doctorTeamLink) { if (ModelState.IsValid) { _context.Add(doctorTeamLink); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DoctorId"] = new SelectList(_context.Doctors, "Id", "Id", doctorTeamLink.DoctorId); return(View(doctorTeamLink)); }