Beispiel #1
0
        public IActionResult TestCases()
        {
            //context will convert this line into query to database
            var data = _repository.GetAllTestCases();

            return(View(data));
        }
Beispiel #2
0
 public IActionResult Get()
 {
     try
     {
         var results = _repository.GetAllTestCases();
         //here we will return a collection of trips for read-only, so IEnumerable type is fine
         //mapper will convert this collection of test cases into collection of test case view models
         return(Ok(Mapper.Map <IEnumerable <TestCaseViewModel> >(results)));
     }
     catch (Exception ex)
     {
         _logger.LogError("Failed to get test cases: {0}", ex);
     }
     return(BadRequest("Error occured."));
 }