Пример #1
0
        public ActionResult Order(FormCollection form)
        {
            using (var context = new SiteContainer())
            {
                var order = new Order {Date = DateTime.Now};
                TryUpdateModel(order, new[] {"ProductId", "ProductImageSource", "Name", "Email", "Phone", "Description","Size"});
                context.AddToOrder(order);
                context.SaveChanges();

                string defaultMailAddressFrom = ConfigurationManager.AppSettings["feedbackEmailFrom"];
                string defaultMailAddresses = ConfigurationManager.AppSettings["feedbackEmailsTo"];

                var emailFrom = new MailAddress(defaultMailAddressFrom, "Студия Евгения Миллера");

                var emailsTo = defaultMailAddresses
                    .Split(new[] { ";", " ", "," }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(s => new MailAddress(s))
                    .ToList();

                var result = Helpers.MailHelper.SendTemplate(emailFrom, emailsTo, "Я - Эго. Форма заказа", "FeedbackTemplate.htm", null, true, form["Name"], form["Email"], form["ProductId"], form["Phone"],order.Id);




                return RedirectToAction("Index", "Home", new {id = "gallery"});
            }
        }
Пример #2
0
 /// <summary>
 /// Create a new Order object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="productId">Initial value of the ProductId property.</param>
 /// <param name="date">Initial value of the Date property.</param>
 public static Order CreateOrder(global::System.Int32 id, global::System.Int32 productId, global::System.DateTime date)
 {
     Order order = new Order();
     order.Id = id;
     order.ProductId = productId;
     order.Date = date;
     return order;
 }
Пример #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Order EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOrder(Order order)
 {
     base.AddObject("Order", order);
 }