1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| [HttpPost]
public JsonResult TestRunList(int jtStartIndex = 0, int jtPageSize = 10, string jtSorting = null)
{
var automationContext = new AutomationRepository();
var testRuns = from tr in automationContext.TestRuns
join t in automationContext.Tests on tr.TestRun_Id equals t.TestRun_Id
orderby tr.Date descending
select new {tr , tr.Name, t , tr.Date , tr.TestRun_Id , tr.Tests} ;
List<MyTestRun> test2 = testRuns.Select(t => new MyTestRun()
{
TestRun_Id = t.TestRun_Id,
Date = t.Date,
Name = t.Name
}).ToList<MyTestRun>();
foreach (var tr in testRuns)
{
if (tr.t.Status == "failed")
{
tr.Name.Replace(tr.Name, "<div class='TestFailed'></div>" + tr.Name);
}
}
var serializer = new JavaScriptSerializer();
serializer.MaxJsonLength = Int32.MaxValue;
JsonResult result = Json(new { Result = "OK", Records = test2 });
return result;
} |
Partager