Beispiel #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Appointment = await _context.Appointments
                          .Include(a => a.Doctor)
                          .Include(a => a.Patient).FirstOrDefaultAsync(m => m.ID == id);

            if (Appointment == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Beispiel #2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Appointment = await _context.Appointments.FindAsync(id);

            if (Appointment != null)
            {
                _context.Appointments.Remove(Appointment);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Appointment = await _context.Appointments
                          .Include(a => a.Doctor)
                          .Include(a => a.Patient).FirstOrDefaultAsync(m => m.ID == id);

            if (Appointment == null)
            {
                return(NotFound());
            }
            ViewData["DoctorID"]  = new SelectList(_context.Doctors, "ID", "DoctorName");
            ViewData["PatientID"] = new SelectList(_context.Patient, "ID", "PatientName");
            return(Page());
        }