public CriterionDTO GetListByClass(Guid id) { CriterionDTO result = new CriterionDTO(); SessionManager.DoWork(session => { Criterion criterion = session.Query <Criterion>().SingleOrDefault(a => a.Id == id); result = criterion.Map <CriterionDTO>(); result.TargetGroupDetail = new TargetGroupDetail() { Id = criterion.TargetGroupDetail.Id }; result.CriterionType = new CriterionType() { Id = result.CriterionType != null ? result.CriterionType.Id : 0 }; }); return(result); }