Ejemplo n.º 1
0
        public List <TestSignatureDto> GetMyTests(int profileId)
        {
            try
            {
                using (var session = DataAccess.OpenSession())
                {
                    var myTests = new List <TestModel>();
                    var courses =
                        session.CreateCriteria(typeof(CourseModel)).List <CourseModel>().Where(
                            c => c.Group.Users.Any(p => p.ID == profileId)).ToList();

                    foreach (var course in courses)
                    {
                        myTests.AddRange(course.Tests);
                    }


                    return(TestSignatureDto.Map(myTests));
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Error : TestService.GetAllTests - {0}", ex.Message);
                return(new List <TestSignatureDto>());
            }
        }
Ejemplo n.º 2
0
 public List <TestSignatureDto> GetAllTests()
 {
     try
     {
         var tests = new Repository <TestModel>().GetAll().ToList();
         return(TestSignatureDto.Map(tests));
     }
     catch (Exception ex)
     {
         Logger.Error("Error : TestService.GetAllTests - {0}", ex.Message);
         return(new List <TestSignatureDto>());
     }
 }