Exemplo n.º 1
0
        public static CartModel GetUserCart(int userid)
        {
            CartModel cart = new CartModel();

            cart.user = UserInfoBLL.GetUserInfoByID(userid);
            var reader = CartDAL.SelectBooksInCart(userid);

            while (reader.Read())
            {
                BookOrderModel book = new BookOrderModel();
                book.book     = BookStatBLL.GetBookByID(reader.GetInt32(0));
                book.enabled  = 1;
                book.quantity = reader.GetInt32(1);
                cart.book.Add(book);
            }
            reader.Close();
            return(cart);
        }