Пример #1
0
        //Updates the appointment.
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Appointment).State = EntityState.Modified;

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AppointmentExists(Appointment.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Пример #2
0
        //Adds a centre to database.
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.MedicalCentre.Add(MedicalCentre);
            _context.SaveChanges();

            return(RedirectToPage("./Index"));
        }
Пример #3
0
        //Adds an appointment to database.
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Appointment.Add(Appointment);
            _context.SaveChanges();

            return(RedirectToPage("./Index"));
        }
Пример #4
0
        //Removes the patient information uses linq query to check presence.
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Patient = (from patient in _context.Patient

                       where patient.Id == id select patient).FirstOrDefault();

            if (Patient != null)
            {
                _context.Patient.Remove(Patient);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }
Пример #5
0
        //Removes the doctor. uses a linq query to check the presence
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Doctor = (from doctor in _context.Doctor

                      where doctor.Id == id
                      select doctor).FirstOrDefault();

            if (Doctor != null)
            {
                _context.Doctor.Remove(Doctor);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }
Пример #6
0
        //Removes a centre uses a linq query to check presence.
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            MedicalCentre = (from centre in _context.MedicalCentre
                             where centre.Id == id
                             select centre
                             ).FirstOrDefault();

            if (MedicalCentre != null)
            {
                _context.MedicalCentre.Remove(MedicalCentre);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }