Beispiel #1
0
        public async Task <IActionResult> CancelAppointment(CancelAppointmentModel cancel)
        {
            //var email = _userManager.GetUserId(HttpContext.User);
            //var user = await _userManager.FindByEmailAsync(email);
            var appointment = _appointmentService.Get().FirstOrDefault(e => e.id == cancel.appointment_id);

            appointment.status        = 171;
            appointment.cancel_reason = cancel.cancel_reason;
            _appointmentService.Update(appointment);
            return(Ok(200));
        }
        public void CancelAppointment(CancelAppointmentModel cancelAppointmentModel)
        {
            var appointment = _iAppointmentDao.GetById(cancelAppointmentModel.AppointmentId);

            var initiator = appointment.Initiator;
            var owner     = appointment.AdOwner;

            _iAppointmentDao.Delete(appointment);

            if (cancelAppointmentModel.OwnerCanceled)
            {
                EmailModelAppointment emailModel = new EmailModelAppointment
                {
                    Sender            = ConfigurationManager.AppSettings["AdminEmail"],
                    SenderName        = owner.FirstName + " " + owner.LastName,
                    Receiver          = initiator.Email,
                    ReceiverFirstName = initiator.FirstName,
                    ReceiverLastName  = initiator.LastName,
                    EmailSubject      = EmailSubjects.AppointmentCanceled,
                    CancelFeedback    = cancelAppointmentModel.FeedbackMessage,
                    AppointmentTitle  = cancelAppointmentModel.AdvertismentTitle,
                    EmailTemplatePath = EmailTemplatesPath.AppointmentCanceledTemplate
                };

                _iMailerService.SendMailAppointments(emailModel);
            }
            else
            {
                EmailModelAppointment emailModel = new EmailModelAppointment
                {
                    Sender            = ConfigurationManager.AppSettings["AdminEmail"],
                    SenderName        = initiator.FirstName + " " + initiator.LastName,
                    Receiver          = owner.Email,
                    ReceiverFirstName = owner.FirstName,
                    ReceiverLastName  = owner.LastName,
                    EmailSubject      = EmailSubjects.AppointmentCanceled,
                    CancelFeedback    = cancelAppointmentModel.FeedbackMessage,
                    AppointmentTitle  = cancelAppointmentModel.AdvertismentTitle,
                    EmailTemplatePath = EmailTemplatesPath.AppointmentCanceledTemplate
                };

                _iMailerService.SendMailAppointments(emailModel);
            }
        }
 public void CancelAppointment([FromBody] CancelAppointmentModel cancelAppointmentModel)
 {
     _iAppointmentBus.CancelAppointment(cancelAppointmentModel);
 }