public ActionResult CheckOut(FormCollection form) { using (var context = new ShopContainer()) { Order order = new Order { DeliveryAddress = form["Order.DeliveryAddress"], Email = form["Order.Email"], Name = form["Order.Name"], OrderDate = DateTime.Now, Phone = form["Order.Phone"], Complited = false }; foreach (var orderItem in WebSession.OrderItems.Select(o => o.Value)) { order.OrderItems.Add(orderItem); } if (order.OrderItems.Any()) { context.AddToOrder(order); context.SaveChanges(); SendEmail(order); WebSession.OrderItems.Clear(); } using (var siteContext = new ShopContainer()) { var model = new SiteModel(siteContext, null); ViewBag.MainMenu = model.Menu; ViewBag.CatalogueMenu = model.CatalogueMenu; model.Title += " - Ваш заказ оформлен"; this.SetSeoContent(model); return View("ThankYou", model); } } }