public async Task <ActionResult <Patientdoctors> > PatientDoctors(long?id) { Patientdoctors appointment = await db.Patientdoctors.FirstOrDefaultAsync(x => x.Id == id); if (appointment == null) { return(NotFound()); } return(new ObjectResult(appointment)); }
public async Task <IActionResult> CreateAppointment(long Doctorid, DateTime VisitDate, long id) { Patientdoctors appointment = new Patientdoctors(); appointment.Doctorid = Doctorid; appointment.Visitdate = VisitDate; appointment.Created = DateTime.Now; appointment.Patientid = id; db.Patientdoctors.Add(appointment); await db.SaveChangesAsync(); return(RedirectToAction("AboutPatient", "Home", id)); }