//
        // GET: /ShoppingList/Edit/5
        public ActionResult Edit(int id)
        {
            var shoppingList = Session.Get<ShoppingList>(id);
            if (shoppingList == null) throw new Exception("Shopping list not found");

            var model = new ShoppingListViewModel(shoppingList);

            return View(model);
        }
        public ActionResult Create(ShoppingListViewModel model)
        {
            var shoppingList = new ShoppingList();

            model.UpdateEntity(shoppingList, HttpContext.User.Identity.Name);

            Session.Save(shoppingList);

            return RedirectToAction("Index");
        }
        public ActionResult Edit(ShoppingListViewModel model)
        {
            var shoppingList = Session.Get<ShoppingList>(model.Id);
            if (shoppingList == null) throw new Exception("Shopping list not found");

            model.UpdateEntity(shoppingList, HttpContext.User.Identity.Name);

            Session.Save(shoppingList);

            return RedirectToAction("Index");
        }
        public ActionResult Create()
        {
            var model = new ShoppingListViewModel();

            return View(model);
        }