コード例 #1
0
ファイル: ApilikeController.cs プロジェクト: BenRoman/QuizApp
        public ActionResult CreateTestingUrl(TestingUrlViewModel testingUrl)
        {
            var testUrlDomain = _advancedMapper.MapTestingUrlViewModel(testingUrl);

            _highLevelTestManagementService.CreateTestingUrl(testUrlDomain);
            return(RedirectToAction("TestingUrlManagement", "Admin"));
        }
コード例 #2
0
        public ActionResult CreateTestingUrl(string testGuid)
        {
            var model = new TestingUrlViewModel
            {
                Guid = testGuid
            };

            return(View(model));
        }
コード例 #3
0
        public TestingUrlViewModel MapTestingUrl(TestingUrl testingUrl)
        {
            var testingUrlViewModel = new TestingUrlViewModel
            {
                AllowedStartDate = testingUrl.AllowedStartDate?.ToString("MM/dd/yyyy HH:mm:ss") ?? "No restrictions",
                AllowedEndDate   = testingUrl.AllowedEndDate?.ToString("MM/dd/yyyy HH:mm:ss") ?? "No restrictions",
                Guid             = testingUrl.Guid,
                Interviewee      = testingUrl.Interviewee,
                IsValid          = _advancedLogicService.IsTestValid(testingUrl.Test),
                TestGuid         = testingUrl.Test.Guid,
                NumberOfRuns     = testingUrl.NumberOfRuns,
                TestName         = testingUrl.Test.Name
            };

            return(testingUrlViewModel);
        }
コード例 #4
0
        public ActionResult Quiz(string guid)
        {
            var testUrlDomain = _getInfoService.GetTestingUrlByGuid(guid);
            var error         = _advancedLogicService.CheckTestingUrlForAvailability(testUrlDomain);
            //if (!string.IsNullOrEmpty(error))
            //{
            //    return View("TestingErrorView",(object)error);
            //}
            //if all is ok
            var testUrl = _advancedMapper.MapTestingUrl(testUrlDomain);
            var model   = new TestingUrlViewModel
            {
                Guid = guid
            };

            return(View(testUrl));
        }
コード例 #5
0
        public TestingUrl MapTestingUrlViewModel(TestingUrlViewModel testingUrlViewModel)
        {
            var testingUrl = _mapper.Map <TestingUrl>(testingUrlViewModel);

            testingUrl.Test = _getInfoService.GetTestByGuid(testingUrlViewModel.TestGuid);
            if (testingUrl.NumberOfRuns == 0)
            {
                testingUrl.NumberOfRuns = -1;
            }
            if (testingUrl.AllowedStartDate == new DateTime(1900, 01, 01))
            {
                testingUrl.AllowedStartDate = null;
            }
            if (testingUrl.AllowedEndDate == new DateTime(1900, 01, 01))
            {
                testingUrl.AllowedEndDate = null;
            }
            return(testingUrl);
        }
コード例 #6
0
        public ActionResult CreateTestingUrl(TestingUrlViewModel model)
        {
            if (model != null)
            {
                if (model.AllowedEndDate == null)
                {
                    model.AllowedEndDate = new DateTime().ToString();
                }
                if (model.AllowedStartDate == null)
                {
                    model.AllowedStartDate = new DateTime().ToString();
                }
            }
            if (ModelState.IsValid)
            {
                var testUrlDomain = _advancedMapper.MapTestingUrlViewModel(model);
                _highLevelTestManagementService.CreateTestingUrl(testUrlDomain);
                return(RedirectToAction("TestingUrlManagement", "Admin"));
            }

            return(View(model));
        }
コード例 #7
0
        public void CreateTestingUrl(TestingUrlViewModel testingUrl)
        {
            var testUrlDomain = _advancedMapper.MapTestingUrlViewModel(testingUrl);

            _highLevelTestManagementService.CreateTestingUrl(testUrlDomain);
        }