Ejemplo n.º 1
0
        public ActionResult RemoveItem( JumblistSession jumblistSession, int postId )
        {
            Post post = postService.SelectRecord( postId );
            jumblistSession.Basket.ClearItem( post );

            return PartialView( "BasketItemsControl", jumblistSession.Basket.Items );
        }
Ejemplo n.º 2
0
        public ViewResult Index( JumblistSession jumblistSession, string returnUrl )
        {
            var model = DefaultView.CreateModel();
            model.PageTitle = "Basket";
            model.Basket = jumblistSession.Basket;
            model.ReturnUrl = returnUrl;

            return View( model );
        }
Ejemplo n.º 3
0
        public ActionResult AddItem( JumblistSession jumblistSession, int id )
        {
            Post post = postService.SelectRecord( id );
            string returnUrl = (Request.IsAjaxRequest()) ? Request.UrlReferrer.PathAndQuery : Request.Url.PathAndQuery;

            jumblistSession.Basket.AddItem( post );
            jumblistSession.Basket.ReturnUrl = returnUrl;

            return PartialView( "BasketWidgetControl", jumblistSession.Basket );
        }
Ejemplo n.º 4
0
        public ActionResult Email( [ModelBinder( typeof( UserModelBinder ) )] User user, JumblistSession jumblistSession, string returnUrl )
        {
            // Empty carts can't be checked out
            if ( jumblistSession.Basket.Items.Count == 0 )
            {
                //ModelState.AddModelError( "Basket", "Sorry, your basket is empty!" );
                Message = new Message { Text = "Sorry, your basket is empty!", StyleClass = "message" };
                return RedirectToAction( "Index", new { returnUrl = returnUrl } );
            }

            mailService.SendBasketEmail( jumblistSession.Basket, user );

            jumblistSession.Basket.ClearAll();
            Message = new Message { Text = "The post details have been emailed to you.", StyleClass = "message" };

            return Redirect( returnUrl ?? "/" );
        }
Ejemplo n.º 5
0
 public RedirectResult RemoveAll( JumblistSession jumblistSession, string returnUrl )
 {
     jumblistSession.Basket.ClearAll();
     Message = new Message { Text = "All posts removed from basket.", StyleClass = "message" };
     return Redirect( returnUrl ?? "/" );
 }
Ejemplo n.º 6
0
 public PartialViewResult Widget( JumblistSession jumblistSession )
 {
     return PartialView( "BasketWidgetControl", jumblistSession.Basket );
 }