public EmailTaskResponse CreateMailTask(CreateEmailSendTask createEmailSendTask) { if (createEmailSendTask == null) { throw new CustomExceptions.ValidationException("Argument could not be null"); } if (string.IsNullOrEmpty(createEmailSendTask.ReceiverAddress)) { throw new CustomExceptions.ValidationException("Receiver address should be provided"); } if (new EmailAddressAttribute().IsValid(createEmailSendTask.ReceiverAddress) == false) { throw new CustomExceptions.ValidationException(""); } Mail mail = new Mail { Content = createEmailSendTask.Content, SenderAddress = "*****@*****.**", ReceiverAddress = createEmailSendTask.ReceiverAddress, Subject = createEmailSendTask.Subject, Date = DateTime.UtcNow, EmailTaskStatus = (int)EmailTaskStatuses.Pending, ScheduledDateTime = createEmailSendTask.ScheduledDate }; _mailRepository.CreateMail(mail); MailScheduledEvent mailScheduledEvent = new MailScheduledEvent { MailId = mail.MailId, ScheduleDate = mail.ScheduledDateTime }; _busControl.Publish(mailScheduledEvent); return(new EmailTaskResponse() { EmailId = mail.MailId, EmailTaskStatuses = (EmailTaskStatuses)mail.EmailTaskStatus, SenderAddress = mail.SenderAddress, Subject = mail.Subject, ScheduledDateTime = mail.ScheduledDateTime, //bunu ekledim ama eklemeli miydim emin değiilim Date = mail.Date /// }); }