public async Task <Core.Models.WeeklyAppointments> GetWeeklyAppointments(DateTime referenceDate) { _monday = referenceDate.AddDays(1 - Helpers.DateConverter.GetIntDayOfWeek(referenceDate.DayOfWeek)); Core.Models.WeeklyAppointments output = new Core.Models.WeeklyAppointments(); output.MondayAppointments = await _appointmentRepository.GetAppointmentsByDateAsync(_monday); output.TuesdayAppointments = await _appointmentRepository.GetAppointmentsByDateAsync(_monday.AddDays(1)); output.WednesdayAppointments = await _appointmentRepository.GetAppointmentsByDateAsync(_monday.AddDays(2)); output.ThursdayAppointments = await _appointmentRepository.GetAppointmentsByDateAsync(_monday.AddDays(3)); output.FridayAppointments = await _appointmentRepository.GetAppointmentsByDateAsync(_monday.AddDays(4)); output.SaturdayAppointments = await _appointmentRepository.GetAppointmentsByDateAsync(_monday.AddDays(5)); output.SundayAppointments = await _appointmentRepository.GetAppointmentsByDateAsync(_monday.AddDays(6)); output.MondayDate = _monday.ToShortDateString(); output.TuesdayDate = _monday.AddDays(1).ToShortDateString(); output.WednesdayDate = _monday.AddDays(2).ToShortDateString(); output.ThursdayDate = _monday.AddDays(3).ToShortDateString(); output.FridayDate = _monday.AddDays(4).ToShortDateString(); output.SaturdayDate = _monday.AddDays(5).ToShortDateString(); output.SundayDate = _monday.AddDays(6).ToShortDateString(); return(output); }
public static WeeklyAppointments AppointmentsForFrontEnd(Core.Models.WeeklyAppointments input, IDapperPatientRepository patientRepository) { WeeklyAppointments output = new WeeklyAppointments(); output.MondayAppointments = GetDailyAppointments(input.MondayAppointments, patientRepository); output.TuesdayAppointments = GetDailyAppointments(input.TuesdayAppointments, patientRepository); output.WednesdayAppointments = GetDailyAppointments(input.WednesdayAppointments, patientRepository); output.ThursdayAppointments = GetDailyAppointments(input.ThursdayAppointments, patientRepository); output.FridayAppointments = GetDailyAppointments(input.FridayAppointments, patientRepository); output.SaturdayAppointments = GetDailyAppointments(input.SaturdayAppointments, patientRepository); output.SundayAppointments = GetDailyAppointments(input.SundayAppointments, patientRepository); output.MondayDate = input.MondayDate; output.TuesdayDate = input.TuesdayDate; output.WednesdayDate = input.WednesdayDate; output.ThursdayDate = input.ThursdayDate; output.FridayDate = input.FridayDate; output.SaturdayDate = input.SaturdayDate; output.SundayDate = input.SundayDate; return(output); }