Exemple #1
0
        public async Task <IActionResult> Create([Bind("PatientID,RUT,FirstName,LastName,BloodType,HealthSystem,Created,Updated")] Patient patient)
        {
            if (ModelState.IsValid)
            {
                _context.Add(patient);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(patient));
        }
        public async Task <IActionResult> Create([Bind("DoctorID,RUT,FirstName,LastName,Specialty,Created,Updated")] Doctor doctor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(doctor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctor));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("AppointmentID,PatientID,DoctorID,Date,Created,Updated")] Appointment appointment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(appointment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DoctorID"]  = new SelectList(_context.Doctors, "DoctorID", "DoctorID", appointment.DoctorID);
            ViewData["PatientID"] = new SelectList(_context.Patients, "PatientID", "PatientID", appointment.PatientID);
            return(View(appointment));
        }