示例#1
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 ?? "/" );
        }
示例#2
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 ?? "/" );
 }
示例#3
0
 public BaseViewModel With( Message message )
 {
     this.Message = message;
     return this;
 }