<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>Kona.Web/Helpers/NHibExtensions.cs</filename>
    </added>
    <added>
      <filename>Kona.Web/Model/Supply/Inventory/BackOrdered.cs</filename>
    </added>
    <added>
      <filename>Kona.Web/Model/Supply/Inventory/Discontinued.cs</filename>
    </added>
    <added>
      <filename>Kona.Web/Model/Supply/Inventory/InStock.cs</filename>
    </added>
    <added>
      <filename>Kona.Web/Model/Supply/Inventory/InventoryState.cs</filename>
    </added>
    <added>
      <filename>Kona.Web/Model/Supply/Inventory/PreOrder.cs</filename>
    </added>
    <added>
      <filename>lib/NHibernate.LambdaExtensions.dll</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff></diff>
      <filename>Kona.Web/App_Data/Kona.mdf</filename>
    </modified>
    <modified>
      <diff></diff>
      <filename>Kona.Web/App_Data/Kona_log.ldf</filename>
    </modified>
    <modified>
      <diff>@@ -12,25 +12,15 @@ namespace Kona.Controllers
     [HandleError]
     public class HomeController : Controller
     {
-        StoreService _service;
-        ISession _session;
+        IStoreService _service;
 
-        public HomeController(ISession session) {
-            _session = session;
-            _service = new StoreService(session);
+        public HomeController(IStoreService service) {
+            _service = service;
         }
 
         public ActionResult Index()
         {
 
-            var stuff = _session.CreateCriteria&lt;Category&gt;()
-                .List&lt;Category&gt;();
-            
-            foreach (var cat in stuff) {
-                var products = cat.Products.Count;
-            }
-
-
             var model = _service.GetHomeModel();
             //return Content(&quot;Success&quot;);
             return View(model);</diff>
      <filename>Kona.Web/Controllers/HomeController.cs</filename>
    </modified>
    <modified>
      <diff>@@ -1,16 +1,14 @@
 &#65279;using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
 using System.Web.Mvc;
 using System.Web.Routing;
+using HibernatingRhinos.Profiler.Appender.NHibernate;
 using Kona.App.Infrastructure;
 using Commerce.MVC.Web;
 using NHibernate;
 using NHibernate.Cfg;
 using System.IO;
 using NHibernate.Context;
-using HibernatingRhinos.NHibernate.Profiler.Appender;
+
 
 namespace Kona
 {</diff>
      <filename>Kona.Web/Global.asax.cs</filename>
    </modified>
    <modified>
      <diff>@@ -1,22 +1,8 @@
-&#65279;using System;
-using System.Data;
-using System.Configuration;
-using System.Linq;
-using System.Web;
-using System.Web.Security;
-using System.Web.UI;
-using System.Web.UI.HtmlControls;
-using System.Web.UI.WebControls;
-using System.Web.UI.WebControls.WebParts;
-using System.Xml.Linq;
-using StructureMap;
+&#65279;using StructureMap;
 using StructureMap.Configuration.DSL;
-using StructureMap.Configuration;
-using StructureMap.Attributes;
-using StructureMap.Pipeline;
-using Kona.Model;
 using NHibernate;
 using Kona;
+using Kona.App.Services;
 
 namespace Commerce.MVC.Web {
     public static class Bootstrapper {
@@ -34,8 +20,9 @@ namespace Commerce.MVC.Web {
 
             ForRequestedType&lt;ISession&gt;()
                 .TheDefault.Is.ConstructedBy(x =&gt; MvcApplication.SessionFactory.GetCurrentSession());
-
-           
+            ForRequestedType&lt;IStoreService&gt;()
+              .TheDefaultIsConcreteType&lt;StoreService&gt;();
+          
         }
     }
 }</diff>
      <filename>Kona.Web/Infrastructure/Bootstrapper.cs</filename>
    </modified>
    <modified>
      <diff>@@ -47,9 +47,9 @@
       &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
       &lt;HintPath&gt;..\lib\DotNetOpenAuth.dll&lt;/HintPath&gt;
     &lt;/Reference&gt;
-    &lt;Reference Include=&quot;HibernatingRhinos.NHibernate.Profiler.Appender, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0774796e73ebf640, processorArchitecture=MSIL&quot;&gt;
+    &lt;Reference Include=&quot;HibernatingRhinos.Profiler.Appender, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0774796e73ebf640, processorArchitecture=MSIL&quot;&gt;
       &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
-      &lt;HintPath&gt;..\lib\HibernatingRhinos.NHibernate.Profiler.Appender.dll&lt;/HintPath&gt;
+      &lt;HintPath&gt;..\..\..\@Apps\NHProf\HibernatingRhinos.Profiler.Appender.dll&lt;/HintPath&gt;
     &lt;/Reference&gt;
     &lt;Reference Include=&quot;Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL&quot;&gt;
       &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
@@ -67,6 +67,10 @@
       &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
       &lt;HintPath&gt;..\lib\NHibernate.ByteCode.Castle.dll&lt;/HintPath&gt;
     &lt;/Reference&gt;
+    &lt;Reference Include=&quot;NHibernate.LambdaExtensions, Version=1.0.8.0, Culture=neutral, PublicKeyToken=706dcfc1e2725d62, processorArchitecture=MSIL&quot;&gt;
+      &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
+      &lt;HintPath&gt;..\lib\NHibernate.LambdaExtensions.dll&lt;/HintPath&gt;
+    &lt;/Reference&gt;
     &lt;Reference Include=&quot;NHibernate.Linq, Version=1.0.0.4000, Culture=neutral, PublicKeyToken=444cf6a87fdab271, processorArchitecture=MSIL&quot;&gt;
       &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt;
       &lt;HintPath&gt;..\lib\NHibernate.Linq.dll&lt;/HintPath&gt;
@@ -105,9 +109,17 @@
     &lt;Compile Include=&quot;Controllers\AccountController.cs&quot; /&gt;
     &lt;Compile Include=&quot;Controllers\HomeController.cs&quot; /&gt;
     &lt;Compile Include=&quot;Controllers\ProductController.cs&quot; /&gt;
+    &lt;Compile Include=&quot;Helpers\NHibExtensions.cs&quot;&gt;
+      &lt;SubType&gt;Code&lt;/SubType&gt;
+    &lt;/Compile&gt;
     &lt;Compile Include=&quot;Infrastructure\Bootstrapper.cs&quot; /&gt;
     &lt;Compile Include=&quot;Infrastructure\KonaControllerFactory.cs&quot; /&gt;
     &lt;Compile Include=&quot;Infrastructure\KonaViewEngine.cs&quot; /&gt;
+    &lt;Compile Include=&quot;Model\Supply\Inventory\Discontinued.cs&quot; /&gt;
+    &lt;Compile Include=&quot;Model\Supply\Inventory\InStock.cs&quot; /&gt;
+    &lt;Compile Include=&quot;Model\Supply\Inventory\InventoryState.cs&quot; /&gt;
+    &lt;Compile Include=&quot;Model\Supply\Inventory\BackOrdered.cs&quot; /&gt;
+    &lt;Compile Include=&quot;Model\Supply\Inventory\PreOrder.cs&quot; /&gt;
     &lt;Compile Include=&quot;Services\StoreService.cs&quot; /&gt;
     &lt;Compile Include=&quot;ViewModels\DetailsViewModel.cs&quot; /&gt;
     &lt;Compile Include=&quot;ViewModels\ProductListViewModel.cs&quot; /&gt;
@@ -391,7 +403,6 @@
     &lt;None Include=&quot;nhibernate-mapping.xsd&quot; /&gt;
   &lt;/ItemGroup&gt;
   &lt;ItemGroup&gt;
-    &lt;Folder Include=&quot;Helpers\&quot; /&gt;
     &lt;Folder Include=&quot;Repositories\&quot; /&gt;
   &lt;/ItemGroup&gt;
   &lt;Import Project=&quot;$(MSBuildBinPath)\Microsoft.CSharp.targets&quot; /&gt;</diff>
      <filename>Kona.Web/Kona.csproj</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,8 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using Iesi.Collections.Generic;
+using Kona.Model.Supply.Inventory;
 
 namespace Kona.Model {
     
@@ -31,27 +33,24 @@ namespace Kona.Model {
         public virtual DeliveryMethod Delivery { get; set; }
         public virtual decimal WeightInPounds { get; set; }
         public virtual bool IsTaxable { get; set; }
-        public virtual InventoryStatus Inventory { get; set; }
         public virtual bool AllowBackOrder { get; set; }
         public virtual bool AllowPreOrder { get; set; }
         public virtual string EstimatedDelivery { get; set; }
         public virtual string DefaultImage { get; set; }
         public virtual DateTime DateAvailable { get; set; }
         public virtual int AmountOnHand { get; set; }
-
+        public virtual InventoryState Inventory { get; set; }
         public virtual decimal DiscountedPrice
         {
             get { return Price * (1.0M - DiscountPercent); } 
         }
 
 
-        public virtual ICollection&lt;Image&gt; Images { get; set; }
-        public virtual ICollection&lt;Product&gt; Related { get; set; }
-        public virtual ICollection&lt;Product&gt; CrossSells { get; set; }
         public virtual ICollection&lt;Descriptor&gt; Descriptors { get; set; }
+        public virtual ICollection&lt;Image&gt; Images { get; set; }
         public virtual ICollection&lt;Product&gt; Recommended { get; set; }
-        public virtual ICollection&lt;Category&gt; Categories { get; set; }
-        public virtual ICollection&lt;InventoryRecord&gt; InventoryRecords { get; set; }
+        
+        public virtual ISet&lt;Category&gt; Categories { get; set; }
         
         #region Object overrides
         public override bool Equals(object obj) {</diff>
      <filename>Kona.Web/Model/Supply/Product.cs</filename>
    </modified>
    <modified>
      <diff>@@ -12,7 +12,6 @@
 		&lt;property name=&quot;Price&quot; column=&quot;BasePrice&quot; not-null=&quot;true&quot; /&gt;
         &lt;property name=&quot;WeightInPounds&quot; column=&quot;WeightInPounds&quot; not-null=&quot;true&quot; /&gt;
         &lt;property name=&quot;DateAvailable&quot; column=&quot;DateAvailable&quot; not-null=&quot;true&quot; /&gt;
-        &lt;property name=&quot;Inventory&quot; column=&quot;InventoryStatusID&quot; not-null=&quot;true&quot; /&gt;
         &lt;property name=&quot;EstimatedDelivery&quot; column=&quot;EstimatedDelivery&quot; not-null=&quot;true&quot; /&gt;
         &lt;property name=&quot;AllowBackOrder&quot; column=&quot;AllowBackOrder&quot; not-null=&quot;true&quot; /&gt;
         &lt;property name=&quot;IsTaxable&quot; column=&quot;IsTaxable&quot; not-null=&quot;true&quot; /&gt;
@@ -20,7 +19,7 @@
         &lt;property name=&quot;AmountOnHand&quot; column=&quot;AmountOnHand&quot; not-null=&quot;true&quot; /&gt;
         &lt;property name=&quot;AllowPreOrder&quot; column=&quot;AllowPreOrder&quot; not-null=&quot;true&quot; /&gt;
         &lt;property name=&quot;Delivery&quot; column=&quot;DeliveryMethodID&quot; not-null=&quot;true&quot; /&gt;
-        &lt;bag name=&quot;Descriptors&quot;&gt;
+        &lt;bag name=&quot;Descriptors&quot; &gt;
             &lt;key column=&quot;SKU&quot;&gt;&lt;/key&gt;
             &lt;one-to-many class=&quot;Descriptor&quot;/&gt;
         &lt;/bag&gt;</diff>
      <filename>Kona.Web/Model/Supply/Product.hbm.xml</filename>
    </modified>
    <modified>
      <diff>@@ -1,14 +1,19 @@
 &#65279;using System;
-using System.Collections.Generic;
 using System.Linq;
-using System.Web;
+using Kona.Helpers;
 using Kona.Model;
 using Kona.ViewModels;
 using NHibernate;
 using NHibernate.Linq;
+using NHibernate.Criterion;
+using NHibernate.LambdaExtensions;
 
 namespace Kona.App.Services {
-    public class StoreService {
+    public interface IStoreService{
+        ProductListViewModel GetHomeModel();
+    }
+
+    public class StoreService : IStoreService{
 
         ISession _session;
         public StoreService(ISession session) {
@@ -39,36 +44,44 @@ namespace Kona.App.Services {
 
 //        }
         public ProductListViewModel GetHomeModel() {
-            var result = new ProductListViewModel();
 
+            var result = new ProductListViewModel();
             //add the featured product
-            result.FeaturedProducts = _session.Linq&lt;Product&gt;()
-                .Where(x =&gt; x.Categories.Any(c =&gt; c.ID == 33));
-
-                //_session.CreateQuery(&quot;select p from Category c join c.Products p where c.Id = :categoryID&quot;)
-                //.SetParameter(&quot;categoryID&quot;, 33).List&lt;Product&gt;();
 
             //categories
-            result.Categories = _session.Linq&lt;Category&gt;();
+            result.Categories = _session
+                .CreateCriteria&lt;Category&gt;()
+                .Future&lt;Category&gt;();
 
 
-            return result;
+            var featuredProduct = _session
+                .CreateCriteria&lt;Product&gt;()
+                .SetFetchMode&lt;Product&gt;(x=&gt;x.Descriptors,FetchMode.Join)
+                .CreateCriteria&lt;Product&gt;(x=&gt;x.Categories)
+                .Add&lt;Category&gt;(x=&gt;x.ID==33)                 
+                .Future&lt;Product&gt;();
+
+            result.FeaturedProduct = featuredProduct.First();
+            result.FeaturedProducts = featuredProduct.Skip(1).Take(3).ToList();
 
 
+
+            return result;
+
         }
 
-//        public DetailsViewModel GetDetails(string sku) {
-//            var result = new DetailsViewModel();
-//            //categories
-//            result.Categories = _repo.GetCategories();
+        //        public DetailsViewModel GetDetails(string sku) {
+        //            var result = new DetailsViewModel();
+        //            //categories
+        //            result.Categories = _repo.GetCategories();
 
-//            //organize them
-//            result.Categories.ToList().ForEach(x =&gt; x.SubCategories = result.Categories.Where(y =&gt; y.ParentID == x.ID).ToList());
+        //            //organize them
+        //            result.Categories.ToList().ForEach(x =&gt; x.SubCategories = result.Categories.Where(y =&gt; y.ParentID == x.ID).ToList());
 
-//            result.SelectedProduct = _repo.GetProduct(sku);
+        //            result.SelectedProduct = _repo.GetProduct(sku);
 
-//            return result;
+        //            return result;
 
-//        }
-   }
+        //        }
+    }
 }</diff>
      <filename>Kona.Web/Services/StoreService.cs</filename>
    </modified>
    <modified>
      <diff>@@ -13,9 +13,10 @@ namespace Kona.ViewModels {
             }
         }
         public IEnumerable&lt;Category&gt; Categories { get; set; }
-        public IEnumerable&lt;Product&gt; FeaturedProducts { get; set; }
-        public IEnumerable&lt;Product&gt; Recent { get; set; }
-        public IEnumerable&lt;Product&gt; Favorite { get; set; }
+        public IList&lt;Product&gt; FeaturedProducts { get; set; }
+        public Product FeaturedProduct { get; set; }
+        public IList&lt;Product&gt; Recent { get; set; }
+        public IList&lt;Product&gt; Favorite { get; set; }
         public Category SelectedCategory { get; set; }
         public Category HomeCategory {
             get {</diff>
      <filename>Kona.Web/ViewModels/ProductListViewModel.cs</filename>
    </modified>
    <modified>
      <diff>@@ -49,7 +49,7 @@
         
         &lt;!--Product widget with 1 product--&gt;
         &lt;div class=&quot;prodWidget&quot;&gt;
-        &lt;%var featured = Model.FeaturedProducts.Take(1).SingleOrDefault(); %&gt;
+        &lt;%var featured = Model.FeaturedProduct; %&gt;
             &lt;h4&gt;
                 Featured&lt;/h4&gt;
             &lt;hr /&gt;
@@ -81,7 +81,7 @@
         &lt;div class=&quot;prodWidget&quot;&gt;
             &lt;h4&gt;Blowout Specials&lt;/h4&gt;
             &lt;hr /&gt;
-            &lt;%foreach (Product p in Model.FeaturedProducts.Skip(1).Take(3)) { %&gt;
+            &lt;%foreach (var p in Model.FeaturedProducts) { %&gt;
             &lt;div class=&quot;fltleft prodItem&quot;&gt;
            
                 &lt;a href=&quot;&lt;%=Url.Action(&quot;Details&quot;,&quot;Product&quot;,new {id=p.SKU}) %&gt;&quot;&gt;&lt;img src=&quot;/content/productimages/&lt;%=p.DefaultImage %&gt;&quot; alt=&quot;&lt;%=p.Name %&gt;&quot; width=&quot;115&quot; height=&quot;115&quot; /&gt;&lt;/a&gt;</diff>
      <filename>Kona.Web/Views/Home/Index.aspx</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>976758baea1251aa85328a860c6ed6b3e2f05df3</id>
    </parent>
  </parents>
  <author>
    <name>Rob Conery</name>
    <email>robconery@gmail.com</email>
  </author>
  <url>http://github.com/robconery/Kona/commit/bfe81af0289580db0b75ad09163311558b43832c</url>
  <id>bfe81af0289580db0b75ad09163311558b43832c</id>
  <committed-date>2009-11-10T19:05:14-08:00</committed-date>
  <authored-date>2009-11-10T19:05:14-08:00</authored-date>
  <message>Updated for episode 4</message>
  <tree>aaedf0aec8efb3d7e8f929a1c6041eaa2c0619a1</tree>
  <committer>
    <name>Rob Conery</name>
    <email>robconery@gmail.com</email>
  </committer>
</commit>
