Example #1
0
        public ActionResult Add(FormCollection form)
        {
            using (var context = new ContentStorage())
            {
                var article = new Article();
                TryUpdateModel(article, new[] { "Title", "Date" });
                article.Text = HttpUtility.HtmlDecode(form["Text"]);
                context.AddToArticle(article);
                context.SaveChanges();

                var mailText = article.Text.Replace("src=\"", "src=\"http://havila-travel.com/");
                var customers = context.Customers.Where(c=>c.IsActive==1).ToList();
                foreach (var customer in customers)
                {
                    mailText += "<br/><br/> Для того, чтобы отписаться от рассылке перейдите пожалуйста по следующей ссылке <br/>";
                    mailText += "<a href=\"http://havila-travel.com/unsubscribe/" + customer.Id + "\">http://havila-travel.com/unsubscribe/" + customer.Id + "</a>";
                    MailHelper.SendMessage(new MailAddress(customer.Email), mailText, "Рассылка Havila-Travel", true);
                }

            }
            return RedirectToAction("Index", "Articles", new { Area = "" });
        }
Example #2
0
 /// <summary>
 /// Create a new Article object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="date">Initial value of the Date property.</param>
 public static Article CreateArticle(global::System.Int64 id, global::System.DateTime date)
 {
     Article article = new Article();
     article.Id = id;
     article.Date = date;
     return article;
 }
Example #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Article EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToArticle(Article article)
 {
     base.AddObject("Article", article);
 }