public CsUser SaveUser(CsUser user)
 {
     using (var session = Provider.CreateSessionFactory().CreateSession())
     {
         var tranx = session.GetTransaction();
         try
         {
             var savedUser = user.ID == 0 ? session.Insert<CsUser>(user) : session.Update<CsUser>(user);
             tranx.Commit();
             return savedUser;
         }
         catch
         {
             tranx.Rollback();
             return null;
         }
     }
 }
 public CsUser GetUser(string username)
 {
     if (username == "fake")
     {
         var fakeUser = new CsUser()
         {
             ID = 9999,
             Email = "*****@*****.**",
             RoleID = 1,
             UserName = "******"
         };
         return fakeUser;
     }
     return UserProvider.Instance.GetUser(username);
 }
        public CsUser SaveUser(CsUser user, string updateBy)
        {
            if (user == null)
                return null;

            user.LastLoggedIn = DateTime.MinValue.AddYears(2000);
            user.UpdatedBy = updateBy;
            user.LastUpdated = DateTime.Now;
            return UserProvider.Instance.SaveUser(user);
        }