Beispiel #1
0
        public ActionResult CompareResultsSimple(string result)
        {
            ResolveInformation inf = new JavaScriptSerializer().Deserialize <ResolveInformation>(result);

            inf.DllFilePath = Server.MapPath("~/Scripts/TestsFolder/" + inf.DllFilePath);
            ITestEndpoints testModule  = ModuleResolver.GetAppDll(inf.DllFilePath, inf.ResolveDllType);
            string         gradeResult = testModule.Grade(result);
            TestEntity     test        = testService.GetTestById(inf.Id);
            AnswerEntity   answerEnt   = new AnswerEntity()
            {
                Content     = System.Text.Encoding.Default.GetBytes(result),
                Mark        = Double.Parse(gradeResult),
                TestId      = test.Id,
                UserId      = userService.GetUserByEmail(User.Identity.Name).Id,
                TestEndTime = DateTime.Now
            };

            testService.CreateAnswer(answerEnt);

            return(Json(new { Mark = gradeResult }));
        }