Exemple #1
0
        public ActionResult DownloadResults(int id)
        {
            UserTestService.LoadWith(x => x.User, x => x.Test);
            var userTests = _.List(GetUserTests(id, false));
            var data      = UserTestResultService.GetResultData(userTests);

            return(File(StringUtils.Encoding1251.GetBytes(CsvUtil.Render(data)),
                        "text/csv", "TestResults-{0}.csv".FormatWith(id)));
        }
Exemple #2
0
        public ActionResult TestResults()
        {
            UserTestService.LoadWith(x => x.User, x => x.Test);
            var testIds   = _.List(707, 706, 708, 705);
            var userTests = UserTestService.GetAll(x => testIds.Contains(x.TestId)).ToList();
            var data      = UserTestResultService.GetResultData(_.List(userTests));

            return(File(Encoding.GetEncoding(1251).GetBytes(CsvUtil.Render(data)),
                        "text/csv", "TestResults.csv"));
        }
Exemple #3
0
        public ActionResult DownloadResult(int groupInfoId)
        {
            List <int> userIds;
            var        groupInfo = GetGroupInfo(groupInfoId, out userIds);

            UserTestService.LoadWith(x => x.User, x => x.Test);
            var userTests = groupInfo.GroupTests.Select(gt => UserTestService.GetUserTests(gt)
                                                        .Where(x => userIds.Contains(x.UserId)).ToList()).ToList();
            var data = UserTestResultService.GetResultData(userTests);

            return(File(Encoding.GetEncoding(1251).GetBytes(CsvUtil.Render(data)),
                        "text/csv", "GroupResults-{0}.csv".FormatWith(groupInfo.Group_ID)));
        }