public ActionResult ShowPassedTests(int?profileId) { if (profileId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } int userId = profileService.GetById(Convert.ToInt32(profileId)).UserId; var testResults = testResultService.GetAllByPredicate(r => r.UserId == userId); var mvcTestResults = testResults.Select(t => t.ToMvcPassedTestResult()).ToArray(); for (int i = 0; i < mvcTestResults.Length; i++) { mvcTestResults[i].Title = testService.GetById(mvcTestResults[i].TestId).Title; } if (Request.IsAjaxRequest()) { return(PartialView("_ShowPassedTests", mvcTestResults)); } return(View("_ShowPassedTests", mvcTestResults)); }