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 PasswordData : BaseData { public string GetCurrent(int userId) { return (from d in GetSession().Query() where d.UserId == userId && d.On == null select d.Password).FirstOrDefault(); } public void EndAllPassword(ISession session, int userId) { foreach (SimplePasswordModel pass in (from d in session.Query() where d.UserId == userId select d).ToList()) { if (!pass.On.HasValue) { pass.On = DateTime.Now; this.Update(pass, session); } } } } }