示例#1
0
        public async Task <IActionResult> PutAppointment(int id, Appointment appointment)
        {
            if (id != appointment.AppointmentId)
            {
                return(BadRequest());
            }

            //_context.Entry(appointment).State = EntityState.Modified;
            var appointmentUpdate = _context.Appointments.First(a => a.AppointmentId == id);

            appointmentUpdate.Description     = appointment.Description;
            appointmentUpdate.DoctorId        = appointment.DoctorId;
            appointmentUpdate.AppointmentTime = appointment.AppointmentTime;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AppointmentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> PutPatient(int id, Patient patient)
        {
            if (id != patient.PatientId)
            {
                return(BadRequest());
            }

            _context.Entry(patient).State = EntityState.Modified;

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

            return(NoContent());
        }
示例#3
0
        public async Task <IActionResult> PutDoctor(int id, Doctor doctor)
        {
            if (id != doctor.DoctorId)
            {
                return(BadRequest());
            }

            _context.Entry(doctor).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DoctorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#4
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Fecha")] Cita cita)
        {
            if (ModelState.IsValid)
            {
                db.Citas.Add(cita);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.Id = new SelectList(db.Pacientes, "PacienteId", "Nombre", cita.Id);
            ViewBag.Id = new SelectList(db.TipoCitas, "TipoCitaId", "Descripcion", cita.Id);
            return(View(cita));
        }