Пример #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            CreatedMedicalHistory.PatientID = storedPID;

            CreatedMedicalHistory.MedicalStrings = new List <MedicalString>();
            createLists();
            if (MedicalHistoryExists(storedMHID))
            {
                CreatedMedicalHistory.ID = storedMHID;

                _context.MedicalHistory.Attach(CreatedMedicalHistory);
                _context.MedicalHistory.Remove(CreatedMedicalHistory);
                await _context.SaveChangesAsync();

                CreatedMedicalHistory.ID = 0;
            }

            _context.MedicalHistory.Add(CreatedMedicalHistory);


            await _context.SaveChangesAsync();


            return(RedirectToPage("./Index"));
        }
Пример #2
0
        // To protect from overposting attacks, enable the specific properties you want to bind to.
        // For more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PatientExists(Patient.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Пример #3
0
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Prescription.Add(Prescription);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task<IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return Page();
            }

            _context.Patient.Add(Patient);
            await _context.SaveChangesAsync();

            return RedirectToPage("./Index");
        }
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync()
        {
            Prescription.patientID = patientID;

            if (PrescriptionExists(Prescription.patientID))
            {
                Prescription old = _context.Prescription.First(e => e.patientID == Prescription.patientID);
                Prescription.ID = old.ID;
                _context.Remove(old);
                _context.Attach(Prescription).State = EntityState.Modified;

                await _context.SaveChangesAsync();
            }
            else
            {
                _context.Prescription.Add(Prescription);
                await _context.SaveChangesAsync();
            }


            return(RedirectToPage("/Patients/History/MDPrescription", new { id = patientID }));
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

            return(RedirectToPage("./Index"));
        }
Пример #7
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Insurance = await _context.Insurance.FindAsync(id);

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

            return(RedirectToPage("./Index"));
        }
Пример #8
0
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                Patients = _context.Patient.ToList();
                return(Page());
            }


            if (_context.Appointment.Any(a => a.ArrivalTime == Appointment.ArrivalTime && a.AppointmentDate == Appointment.AppointmentDate))
            {
                Patients = _context.Patient.ToList();
                ModelState.AddModelError(string.Empty, "Appointment time " + Util.Util.ConverTime(Appointment.ArrivalTime) + " at " + Appointment.AppointmentDate.ToShortDateString() + " is already booked");
                return(Page());
            }
            Appointment.AppointmentDate = Appointment.AppointmentDate.Date;
            _context.Appointment.Add(Appointment);
            await _context.SaveChangesAsync();

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