public IActionResult Get() { List <Appointment> appointments = _appointmentService.InitializeAppointments("2406978890047", new DateTime(2020, 12, 5)); List <AvailableAppointmentsDTO> dto = AppointmentMapper.AppointmentsToAvailableAppointmentsDTO(appointments); return(Ok(dto)); }
public void Map_appointment_persistance_to_appointment_entity_when_persistance_is_null() { AppointmentPersistence appointmentsPersistance = null; Assert.Throws <ArgumentNullException>(() => AppointmentMapper.MapAppointmentsPersistenceToAppointmentsEntity(appointmentsPersistance)); }
public void Map_appointment_persistance_collection_to_appointment_entity_collection_when_collection_is_null() { List <AppointmentPersistence> listOfAppointmentsPersistance = null; Assert.Throws <ArgumentNullException>(() => AppointmentMapper.MapAppointmentsPersistenceCollectionToAppointmentsEntityCollection(listOfAppointmentsPersistance)); }
public IEnumerable <Appointment> GetForPatient(Guid patientId) { using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext)) { return(AppointmentMapper.MapAppointmentsPersistenceCollectionToAppointmentsEntityCollection(_context.Appointments.Where(c => c.PatientPersistanceId == patientId && c.IsCanceled == false).ToList())); } }
public IEnumerable <Appointment> GetAll() { using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext)) { return(AppointmentMapper.MapAppointmentsPersistenceCollectionToAppointmentsEntityCollection(_context.Appointments.ToList())); } }
public Appointment GetById(Guid id) { using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext)) { return(AppointmentMapper.MapAppointmentsPersistenceToAppointmentsEntity(_context.Appointments.SingleOrDefault(c => c.Id.Equals(id)))); } }
public IEnumerable <Appointment> GetForDoctor(Guid doctorId) { using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext)) { return(AppointmentMapper.MapAppointmentsPersistenceCollectionToAppointmentsEntityCollection(_context.Appointments.Where(c => c.Id.Equals(doctorId) && c.IsCanceled == false))); } }
public void Map_appointment_persistence_to_appointment_entity_when_appointment_persistance_is_null() { Appointment appointment = null; Assert.Throws <ArgumentNullException>(() => AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(appointment)); }
public IActionResult GetAvailable(SearchAppointmentsStandardDTO appointmentsDTO) { List <Appointment> appointments = _appointmentService.GetAvailableBy(appointmentsDTO.DoctorId, appointmentsDTO.Date).ToList(); List <AvailableAppointmentsDTO> dto = AppointmentMapper.AppointmentsToAvailableAppointmentsDTO(appointments); return(Ok(dto)); }
public IActionResult GetCancelableAppointments() { string id = User.Identity.Name; List <Appointment> appointments = _appointmentService.GetCancelableAppointments(id); List <GetAppointmentDTO> appointmentsDTO = AppointmentMapper.ListAppointmentToListGetAppointmentDTO(appointments); return(Ok(appointmentsDTO)); }
public IEnumerable <Appointment> GetAppointmentForDoctorForDate(Guid doctorId, DateTime requestDate) { using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext)) { return(AppointmentMapper.MapAppointmentsPersistenceCollectionToAppointmentsEntityCollection(_context.Appointments.ToList()) .Where(x => x.DoctorId.Equals(doctorId) && x.DateRange.StartDateTime.Date.Equals(requestDate.Date) && x.IsCanceled == false)); } }
private IdentifiableDTO <AppointmentDTO> InitializeAppointments(Appointment appointment, Guid patientId, Guid doctorId) { IdentifiableDTO <AppointmentDTO> appointmentDTO = AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(appointment); appointmentDTO.EntityDTO.PatientId = patientId; appointmentDTO.EntityDTO.DoctorId = doctorId; return(appointmentDTO); }
public void Map_appointment_persistence_to_appointment_entity() { AppointmentPersistence appointmentsPersistance = this.GetAppointmentPersistanceFirst(); Appointment appointments = AppointmentMapper.MapAppointmentsPersistenceToAppointmentsEntity(appointmentsPersistance); Assert.True(this.IsEqualAppointmentPersistanceAndAppointmentEntity(appointmentsPersistance, appointments)); }
public void Update(Appointment entity) { using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext)) { _context.Appointments.Update(AppointmentMapper.MapAppointmentEntityToAppointmentPersistence(entity)); _context.SaveChanges(); } }
public void Map_appointment_entity_to_appointment_identifier_dto() { Appointment appointment = this.GetPatient(); IdentifiableDTO <AppointmentDTO> appointmentDTO = AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(appointment); Assert.True(IsEqualAppointmentPersistanceAndAppointmentEntity(appointmentDTO, appointment)); }
public void Map_appointment_persistance_collection_to_appointment_entity_collection() { List <AppointmentPersistence> appointmentsPersistance = this.GetListOfAppointmentPersistance(); List <Appointment> listOfAppointments = AppointmentMapper.MapAppointmentsPersistenceCollectionToAppointmentsEntityCollection(appointmentsPersistance).ToList(); Assert.True(this.IsEqualAppointmentPersistanceAndAppointmentEntity(appointmentsPersistance[0], listOfAppointments[0])); Assert.True(this.IsEqualAppointmentPersistanceAndAppointmentEntity(appointmentsPersistance[1], listOfAppointments[1])); }
private AppointmentReasonsResult GetAppointmentReasons(string providerID) { var postData = AppointmentMapper.MapToAppointmentReasonsPOSTData(providerID); var restUrl = "/patientappointmentreasons "; JToken action = api.GET(restUrl, postData); return(GetReasonsResults(action)); }
private CreateAppointmentResult Create(Appointment appointment, string departmentID) { var postData = AppointmentMapper.MapToPOSTData(appointment, departmentID); var restUrl = "/appointments"; JToken action = api.POST(restUrl, postData); return(GetCreateResults(action)); }
public IActionResult GetAvailable2(SearchAppointmentsDTO appoitmentsDTO) { PriorityParameters parameters = AppointmentMapper.SearchAppointmentsDTOToPriorityParameters(appoitmentsDTO); List <Appointment> appointments = _appointmentService.GetAvailableByStrategy(parameters).ToList(); List <AvailableAppointmentsDTO> dto = AppointmentMapper.AppointmentsToAvailableAppointmentsDTOWithDoctor(appointments); return(Ok(dto)); }
private AppointmentSlotsResult GetAppointmentSlots() { var postData = AppointmentMapper.MapToAppointmentSlotsPOSTData(); var restUrl = "/appointments/open"; JToken action = api.POST(restUrl, postData); return(GetSearchResults(action)); }
public void TestInitialize() { MockDatabase = new Mock <IDatabase>(); MockQuery = new Mock <IQuery>(); MockHydrater = new Mock <IHydrater <AppointmentVO> >(); Target = new AppointmentMapper(MockDatabase.Object, MockHydrater.Object); MockDatabase.Setup(m => m.CreateQuery(It.IsAny <string>())).Returns(MockQuery.Object); }
public List <TestPatientAppointment> InitiateTestPatients() { RA.TestAppointmentList testapptlist = new RA.TestAppointmentList(); testapptlist.BackgroundListLoad(); List <TestPatientAppointment> Testpatients = new List <TestPatientAppointment>(); foreach (TestAppointment app in testapptlist) { TestPatientAppointment item = AppointmentMapper.FromRATestAppointment(app); Testpatients.Add(item); } return(Testpatients); }
public IdentifiableDTO <AppointmentDTO> GetById(Guid id) { try { return(AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(_appointmentRepository.GetById(id))); } catch (ArgumentNullException e) { throw new NotFoundEntityException(); } catch (Exception e) { throw new InternalServerErrorException(); } }
public IEnumerable <IdentifiableDTO <AppointmentDTO> > GetForPatient(Guid patientId) { try { return(_appointmentRepository.GetForPatient(patientId).Select(c => AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(c))); } catch (ArgumentNullException e) { throw new NotFoundEntityException(); } catch (Exception e) { throw new InternalServerErrorException(); } }
public async Task <Appointment> GetAppointmentByIdAsync(int appointmentId) { try { Appointments dbAppointment = await _context.Appointments.FindAsync(appointmentId); if (dbAppointment == null) { return(null); } return(AppointmentMapper.Map(dbAppointment)); } catch (Exception e) { return(null); } }
public IServiceResult Create(IServiceInput input) { var vm = input as CreateAppointmentVM; //var providers = providerService.Search(new ProviderSearchInput()); //TODO: pass in provider ID var apptReasons = GetAppointmentReasons(vm.ProviderID); //var apptSlots = GetAppointmentSlots(); // map patient Appointment appointment = CreateAppointmentVMMapper.MapToAppointment(vm); // call core method CreateAppointmentResult retval = Create(appointment, vm.DepartmentID); // return mapped result return(AppointmentMapper.MapToCreateAppointmentVM(appointment, retval)); }
public async Task <bool> AddAppointmentToCaseAsync(Case targetCase, Appointment appointment, bool save = true) { try { // First, add the appointment to appointments appointment.CaseId = targetCase.Id; _context.Appointments.Add(AppointmentMapper.Map(appointment)); // Finally, add the appointment to the case model's appointments targetCase.Appointments.Add(appointment); if (save) { await _context.SaveChangesAsync(); } return(true); } catch (Exception e) { return(false); } }
public IActionResult Schedule(ScheduleAppointmentDTO dto) { try { ValidateScheduleAppointment.Validate(dto); } catch (Exception) { return(BadRequest("Can not schedule appointmnet in the past")); } dto.PatientId = User.Identity.Name; Appointment appointment = AppointmentMapper.ScheduleAppointmentDTOToAppointment(dto); appointment.PatientId = dto.PatientId; Appointment scheduledAppointment = _appointmentService.ScheduleAppointment(appointment); if (scheduledAppointment == null) { return(BadRequest("Can not schedule appointment")); } return(Ok("Scheduled!")); }
public IEnumerable <IdentifiableDTO <AppointmentDTO> > GetAppointmentForDoctorForDate(Guid doctorId, DateTime time) { try { return(_appointmentRepository.GetAppointmentForDoctorForDate(doctorId, time).Select(c => AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(c))); } catch (ArgumentNullException e) { throw new NotFoundEntityException(); } catch (Exception e) { throw new InternalServerErrorException(); } }
[HttpGet("getScheduledAppointmetsByPatient/{patientId}")] // GET /api/appointment/getScheduledAppointmetsByPatient/{patientId} public IActionResult GetScheduledAppointmentsByPatient(int patientId) { List <AppointmentDto> result = new List <AppointmentDto>(); App.Instance().AppointmentService.GetScheduledAppointmetsByPatient(patientId, DateTime.Now).ToList().ForEach(appointment => result.Add(AppointmentMapper.AppointmentToAppointmentDto(appointment))); if (result.Count == 0) { return(NotFound()); } return(Ok(result)); }