public object Any(ViewTestPlan request) { var testPlan = Db.Single <TestPlan>(q => q.Slug == request.Slug); if (testPlan == null) { throw HttpError.NotFound(request.Slug); } var testRun = request.Id != null ? Db.Single <TestRun>(x => x.TestPlanId == testPlan.Id && x.Id == request.Id) : Db.Select <TestRun>(q => q.Where(x => x.TestPlanId == testPlan.Id) .OrderByDescending(x => x.Id)) .FirstOrDefault(); var testResults = Db.Select <TestResult>(q => q.TestRunId == testRun.Id); return(new ViewTestPlanResponse { TestPlan = testPlan, TestRun = testRun, Results = testResults.ConvertAll(x => x.ToDisplayResult()) }); }
public object Any(ViewTestPlan request) { var testPlan = Db.Single<TestPlan>(q => q.Slug == request.Slug); if (testPlan == null) throw HttpError.NotFound(request.Slug); var testRun = request.Id != null ? Db.Single<TestRun>(x => x.TestPlanId == testPlan.Id && x.Id == request.Id) : Db.Select<TestRun>(q => q.Where(x => x.TestPlanId == testPlan.Id) .OrderByDescending(x => x.Id)) .FirstOrDefault(); var testResults = Db.Select<TestResult>(q => q.TestRunId == testRun.Id); return new ViewTestPlanResponse { TestPlan = testPlan, TestRun = testRun, Results = testResults.ConvertAll(x => x.ToDisplayResult()) }; }