public object BindModel( ControllerContext controllerContext, ModelBindingContext bindingContext )
        {
            if (bindingContext.Model != null)
                throw new InvalidOperationException( "Cannot update instances" );

            Basket basket = controllerContext.HttpContext.Session[basketCookieKey] as Basket;

            if (basket == null)
            {
                basket = new Basket();
                controllerContext.HttpContext.Session[basketCookieKey] = basket;
            }
            
            return basket;
        }
Beispiel #2
0
        public void SendBasketEmail( Basket basket, User user )
        {
            string emailSubject = "Basket Mail";

            IDictionary tokens = new Hashtable();
            tokens.Add( "basket", basket );
            tokens.Add( "user", user );
            tokens.Add( "homeurl", homeUrl );

            string emailBody = GenerateEmailText( tokens, "BasketEmail.vm" );

            SendMail( user.Email, emailSubject, emailBody, true );
        }