public void FeedbackForm(FeedbackFormModel feedbackFormModel) { using (var context = new ModelContainer()) { var feedback = new Feedback { Email = feedbackFormModel.Email, Text = feedbackFormModel.Text, Title = feedbackFormModel.Name }; context.AddToFeedback(feedback); context.SaveChanges(); var responseData = MailHelper.SendTemplate( new List<MailAddress> { new MailAddress("*****@*****.**"), new MailAddress("*****@*****.**") }, "Форма обратной связи RVK", "FeedbackTemplate.htm", null, true, feedbackFormModel.Name, feedbackFormModel.Email, feedbackFormModel.Text); var responseFeedback = new Feedback{Email = "",Text = responseData.ErrorMessage,Title = responseData.EmailSent.ToString()}; context.AddToFeedback(responseFeedback); context.SaveChanges(); } }
public void Subscribe(string subscr) { using (var context = new ModelContainer()) { var exist = context.Subscriber.FirstOrDefault(s => s.Email == subscr); if (exist != null) return; var subscriber = new Subscriber {Email = subscr}; context.AddToSubscriber(subscriber); context.SaveChanges(); } }