コード例 #1
0
 public AppointmentEmailNotificationDto CreateAppointmentNotificationDto(Appointment appointment)
 {
     if (appointment != null)
     {
         AppointmentEmailNotificationDto dto = new AppointmentEmailNotificationDto
         {
             DoctorEmail     = appointment?.Doctor?.User?.Email,
             DoctorFirstName = appointment?.Doctor?.User?.FirstName,
             DoctorLastName  = appointment?.Doctor?.User?.LastName,
             ClientEmail     = appointment?.Animal?.Client?.User?.Email,
             ClientFirstName = appointment?.Animal?.Client?.User?.FirstName,
             ClientLastName  = appointment?.Animal?.Client?.User?.LastName,
             AnimalName      = appointment?.Animal?.Name,
             AnimalType      = appointment?.Animal?.AnimalType?.AnimalTypeName,
             Date            = appointment?.AppointmentDate.ToString(),
             ServiceName     = appointment?.Service?.ServiceName,
             StatusId        = appointment?.StatusId
         };
         return(dto);
     }
     else
     {
         return(null);
     }
 }
コード例 #2
0
        //appointment
        public async Task SendAppointmentNotifications(int appointmentId)
        {
            Appointment appointment = await _appointmentService.GetAppointmentByIdAsync(appointmentId);

            if (appointment != null)
            {
                AppointmentEmailNotificationDto dto = CreateAppointmentNotificationDto(appointment);

                await SendAppointmentNotificationDoctor(dto);
                await SendAppointmentNotificationClient(dto);
            }
        }
コード例 #3
0
        public async Task SendAppointmentNotificationClient(AppointmentEmailNotificationDto dto)
        {
            string emailTo = dto.ClientEmail;

            if (emailTo != null)
            {
                EmailModel email = new EmailModel
                {
                    EmailsTo = new List <string> {
                        emailTo
                    },
                    Subject = EmailHelper.AppointmentClientSubject,
                    Message = EmailHelper.AppointmentClientMessage(dto)
                };
                await SendEmailAsync(email);
            }
        }