Beispiel #1
0
        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();
            }
        }
Beispiel #2
0
 public ActionResult Subscribers()
 {
     using (var context = new ModelContainer())
     {
         var subscr = context.Subscriber.ToList();
         return View(subscr);
     }
 }
Beispiel #3
0
 public ActionResult FeedBack()
 {
     using (var context = new ModelContainer())
     {
         var feedbacks = context.Feedback.ToList();
         return View(feedbacks);
     }
 }
Beispiel #4
0
        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();
            }
        }