Exemple #1
0
        public ActionResult <List <TestOutputModel> > GetAllTests()
        {
            Mapper           mapper = new Mapper();
            AuthorDataAccess tests  = new AuthorDataAccess();

            List <TestOutputModel> listOfModels = mapper.ConvertTestDTOToTestModelList(tests.GetAllTests());

            foreach (var i in listOfModels)
            {
                TestStatistics    statistics = new TestStatistics(i.ID);
                PassedFailedModel pfs        = statistics.GetPassedFailedStats(i.ID);
                i.AverageResult = statistics.GetAverageResults(i.ID);
                i.Passed        = pfs.Passed;
                i.Failed        = pfs.Failed;
                i.SuccessRate   = pfs.SuccessRate;
            }
            return(Ok(listOfModels));
        }