private NewsletterSubscription ConvertDto(NewsletterSubscriptionDTO h) { return(new NewsletterSubscription { Email = h.email, IsActive = h.isActive, DateSubscribed = h.dateSubscribed.ConvertFromUnixTimeStamp(), DateUnsubscribed = h.dateUnsubscribed.ConvertFromUnixTimeStamp(), }); }
/// <summary> /// The subscribe. /// </summary> /// <param name="email"> /// The email. /// </param> /// <returns> /// The <see cref="NewsletterSubscriptionDTO"/>. /// </returns> public NewsletterSubscriptionDTO SubscribeToNewsletter(string email) { ValidationResult validationResult; var dto = new NewsletterSubscriptionDTO { email = email, dateSubscribed = DateTime.Now.ConvertToUnixTimestamp(), isActive = true }; if (this.IsValid(dto, out validationResult)) { var newsletterSubscription = ConvertDto(dto); this.NewsletterSubscriptionModel.RegisterSave(newsletterSubscription, true); ////IoC.Resolve<RealTimeNotificationModel>().NotifyClientsAboutChangesInTable<EmailHistory>(NotificationType.Update, emailHistory.Id); return(dto); } var error = this.GenerateValidationError(validationResult); this.LogError("Email.SubscribeToNewsletter", error); throw new FaultException <Error>(error, error.errorMessage); }