using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using NHibernate; using NHibernate.Linq; using Sleis.Models; using Sleis.Infrastructure; namespace Sleis.Data { public class NewsData : BaseData { public List GetActiveList() { return (from d in GetSession().Query() where d.StartDate <= DateTime.Now && (d.EndDate ==null || d.EndDate >= DateTime.Now) select new SimpleNewsItemModel(d.Id, d.Title, d.StartDate)).ToList(); } public List GetActiveList(int exeptId) { return (from d in GetSession().Query() where d.StartDate <= DateTime.Now && (d.EndDate == null || d.EndDate >= DateTime.Now) && d.Id != exeptId select new SimpleNewsItemModel(d.Id, d.Title, d.StartDate)).ToList(); } } }