public ActionResult Create(MVC5Templates.Models.OrderViewModel orderViewModel)
        {
            if (ModelState.IsValid)
            {
				using(var db = new NorthWndContext())
				{
					db.Orders.Add(orderViewModel.Order);
					db.SaveChanges();
				}
                return RedirectToAction("Index");
            }

			orderViewModel = RefreshViewModel(orderViewModel);
			return View(orderViewModel);
        }
		public ActionResult Edit(MVC5Templates.Models.OrderViewModel orderViewModel)
        {
            if (ModelState.IsValid)
            {
				using(var db = new NorthWndContext())
				{
					db.Entry(orderViewModel.Order).State = EntityState.Modified;
					db.SaveChanges();
				}
                return RedirectToAction("Index");
            }

			orderViewModel = RefreshViewModel(orderViewModel);
			return View(orderViewModel);
        }
 public OrdersController()
 {
     _db = new NorthWndContext();
     _db.Configuration.ProxyCreationEnabled = false;
 }
		public ActionResult DeleteConfirmed(int id)
        {
			using(var db = new NorthWndContext())
			{
				var order = db.Orders.Find(id);
				db.Orders.Remove(order);
				db.SaveChanges();
			}

            return RedirectToAction("Index");
        }