コード例 #1
0
        public ActionResult RemoveFromCart(Guid id)
        {
            PhoneItem phone = PhoneItemManager.Get(id);

            if (phone != null)
            {
                GetCart().RemoveLine(phone);
            }
            return(RedirectToAction("Index", "Cart"));
        }
コード例 #2
0
        public RedirectToRouteResult PlusQuantityFromCart(Guid id)
        {
            PhoneItem phone = PhoneItemManager.Get(id);

            if (phone != null)
            {
                GetCart().AddItem(phone, 1);
            }
            ViewBag.Count = GetCart().Lines.Count();
            return(RedirectToAction("Index", "Cart"));
        }
コード例 #3
0
        public ActionResult Edit(Guid id)
        {
            var result = PhoneItemManager.Get(id);

            if (result == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(View(result));
            }
        }
コード例 #4
0
        public ActionResult Details(Guid id)
        {
            var result = PhoneItemManager.Get(id);

            if (result == null)
            {
                return(RedirectToRoute(new { controller = "Home", action = "Index" }));
            }
            else
            {
                return(View("../Phone/Details", result));
            }
        }
コード例 #5
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            var onephone = PhoneItemManager.Get(id);

            if (onephone == null)
            {
                return(RedirectToRoute(new { controller = "Home", action = "Index" }));
            }
            else
            {
                PhoneItemManager.DeletePhone(id);
                return(RedirectToRoute(new { controller = "Home", action = "Index" }));
            }
        }
コード例 #6
0
        public ActionResult Delete(Guid id)
        {
            var onephone = PhoneItemManager.Get(id);

            if (onephone != null)
            {
                return(View(onephone));
            }
            else
            {
                var resultlist = PhoneItemManager.GetPhones();
                var result     = resultlist.ToPagedList(1, 3);
                return(View(result));
            }
        }