コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("PatientID,RUT,FirstName,LastName,BloodType,HealthSystem,Created,Updated")] Patient patient)
        {
            if (id != patient.PatientID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    patient.Updated = DateTime.Now;
                    _context.Update(patient);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PatientExists(patient.PatientID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(patient));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("DoctorID,RUT,FirstName,LastName,Specialty,Created,Updated")] Doctor doctor)
        {
            if (id != doctor.DoctorID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    doctor.Updated = DateTime.Now;
                    _context.Update(doctor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DoctorExists(doctor.DoctorID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctor));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("AppointmentID,PatientID,DoctorID,Date,Created,Updated")] Appointment appointment)
        {
            if (id != appointment.AppointmentID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    appointment.Updated = DateTime.Now;
                    _context.Update(appointment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppointmentExists(appointment.AppointmentID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }