views:

25

answers:

0

I have the following method that creates a view model. On my mvc app i called this on http get:

"/Product.aspx/Edit/8024"

and then on http post

"/Product.aspx/Edit/8024"

My issue is that when i called it on "post" i don't get the entire product class, ie it's missing generic list ie

List<Category> categories

Here is the method that i call on both post and get.

private ProductViewModel EditViewModel(int id)
{
    var product = _productRepository.Get(id);


    var viewModel = new ProductViewModel
    {
        Product = product
    };
    return viewModel;
}

I've tried flush and refresh but it doesn't retrive this list.

   public Product Get(int id)
    {
             _session.Flush();
            Product product = _session
                .CreateCriteria(typeof(Product))
                .Add(Restrictions.Eq("Id", id))
                .UniqueResult<Product>();
            return product;
    }