public async Task <IActionResult> Edit(int id, [Bind("Id,Day,StartTime,EndTime,DoctorId")] Schdeule schdeule) { if (id != schdeule.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(schdeule); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SchdeuleExists(schdeule.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DoctorId"] = new SelectList(_context.Doctor, "Id", "Name", schdeule.DoctorId); return(View(schdeule)); }
public async Task <IActionResult> Create([Bind("Id,Day,StartTime,EndTime,DoctorId")] Schdeule schdeule) { if (ModelState.IsValid) { _context.Add(schdeule); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DoctorId"] = new SelectList(_context.Doctor, "Id", "Name", schdeule.DoctorId); return(View(schdeule)); }