public void CreatesRangeWithStartDateLastingOneDay()
    {
      var dtr = DateTimeRange.CreateOneDayRange(DateTimes.TestDateTime);

      dtr.Start.Should().Be(DateTimes.TestDateTime);
      dtr.End.Should().Be(dtr.Start.AddDays(1));
    }
Пример #2
0
        private Schedule GetScheduleForClinicAndDate(int clinicId, DateTime date)
        {
            // gets one schedule entity, and then pulls the id from that tracked EF entity
            // Guid scheduleId = _context.Schedules.FirstOrDefault(s => s.ClinicId == clinicId).Id;

            // gets just the Guid id from the database
            Guid scheduleId = _context.Schedules
                              .Where(s => s.ClinicId == clinicId)
                              .Select(s => s.Id)
                              .FirstOrDefault();

            return(new Schedule(scheduleId, DateTimeRange.CreateOneDayRange(date), clinicId));
        }
Пример #3
0
        public Schedule GetScheduleForDate(int clinicId, DateTime date)
        {
            Guid scheduleId = GetScheduleIdForClinic(clinicId);

            // populate appointments
            var appointments = _context.Appointments
                               .Where(a => a.ScheduleId == scheduleId &&
                                      DbFunctions.DiffDays(date, a.TimeRange.Start) == 0)
                               .ToList();
            var apptHighlights = GetAppointmentHighlights(date, scheduleId);

            appointments.ForEach(a => a.Title = apptHighlights
                                                .Where(h => h.Id == a.Id)
                                                .Select(h => h.Title)
                                                .FirstOrDefault()
                                 );

            return(new Schedule(scheduleId, DateTimeRange.CreateOneDayRange(date), clinicId, appointments));
        }