Ejemplo n.º 1
0
        public static Intervention InterventionForFrontEnd(Core.Models.Intervention intervention,
                                                           IDapperToothRepository toothRepository,
                                                           IDapperPatientRepository patientRepository,
                                                           IDapperAppointmentRepository appointmentRepository)
        {
            Intervention output = new Intervention();

            output.Id            = intervention.Id;
            output.AppointmentId = intervention.AppointmentId;
            output.PatientName   = PatientConverter.PatientForFrontEnd(
                patientRepository.GetPatientByIdAsync(
                    appointmentRepository.GetAppointmentByIdAsync(intervention.AppointmentId)
                    .Result.PatientId)
                .Result)
                                   .FullName;
            output.AppointmentDate = appointmentRepository.GetAppointmentByIdAsync(intervention.AppointmentId).Result.AppointmentDate;
            output.ToothId         = intervention.ToothId;
            output.ToothCode       = toothRepository.GetToothByIdAsync(intervention.ToothId).Result.ToothCode;
            output.Description     = intervention.Description;

            return(output);
        }
        // GET: Appointment/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var app = await _appointmentRepository.GetAppointmentByIdAsync(id.Value);//await _dbDataAccess.GetAppointmentByIdAsync(id.Value);

            if (app == null)
            {
                return(NotFound());
            }

            ViewBag.ListOfPatients = PatientConverter.ListForFrontEnd(await _patientRepository.GetAllPatientsAsync());
            ViewBag.ListOfHours    = hours.Hours;
            ViewBag.ListOfMinutes  = hours.Minutes;

            var appointment = await AppointmentConverter.AppointmentForFrontEnd(app, _patientRepository);

            return(View(appointment));
        }