public IList<House> GetFullList()
{
try
{
var session = SessionFactory.GetCurrentSession();
return session.QueryOver<House>()
.OrderBy(x => x.Owner).Asc
.List<House>();
}
catch (NHibernate.ADOException nex)
{
log.Error(System.Reflection.MethodBase.GetCurrentMethod().Name + " Error-- " + nex.ToString());
throw new Exception(ExceptionConstants.ERR_DATABASE_ERROR);
}
}
the code above is on “PostService.css”. For now i`m trying to retrieve all my data from database into a view called AllHouses() using that method. The entities of House consist. Owner, Price, Location and Description. How can i get my data into GridView. I would like to make “edit” “delete” function as well..
Simply by iterating through the list that the method returns. So if you call it form inside an action:
And in the
HouseListview (HouseList.cshtml) you can for instance iterate throughthe list of houses and render them in a table:
If you have a Grid control you can use the
Modelproperty of the view to build it up.