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; using Sleis.Utility; namespace Sleis.Data { public class UserAnswerData : BaseData { public List GetByUserId(int userId) { return (from d in GetSession().Query() where d.UserId == userId orderby d.Index select d).ToList(); } public void SaveUserAnswers(ISession session, int userId, List list) { /*session.CreateSQLQuery("DELETE FROM SEC_USER_ANSWER WHERE SEC_USER_ID=:userId") .SetInt32("userId", userId) .ExecuteUpdate(); */ foreach (UserAnswerModel obj in list) { if (obj.Answer == "") break; session.Save(obj); } } } }