public async Task <IActionResult> UpdateTest([FromBody] EditTestModel editTestModel)
        {
            var editTestDto  = mapper.Map <EditTestDto>(editTestModel);
            var updateResult = await testService.UpdateTest(editTestDto);

            return(responseComposer.ComposeUpdateTest(updateResult));
        }
        public async Task <IActionResult> AddTest([FromBody] EditTestModel addTestModel)
        {
            var addTestDto = mapper.Map <AddTestDto>(addTestModel);
            var addResult  = await testService.AddTest(addTestDto);

            return(responseComposer.ComposeAddTest(addResult));
        }
Ejemplo n.º 3
0
        public ActionResult Edit(int id, EditTestModel testEdit, string addArea, string save, string addGroup)
        {
            //			if (!ModelState.IsValid) return RedirectToAction("Index");
            try
            {
                if (!string.IsNullOrEmpty(save))
                {
                    var originalTest = testFacade.GetTestTemplateById(id);
                    originalTest.Date           = testEdit.test.Date;
                    originalTest.Name           = testEdit.test.Name;
                    originalTest.CompletionTime = testEdit.test.CompletionTime;
                    originalTest.NumOfQuestions = testEdit.test.NumOfQuestions;

                    testFacade.UpdateTestTemplate(originalTest);

                    return(RedirectToAction("Index"));
                }

                if (!string.IsNullOrEmpty(addArea))
                {
                    testFacade.AddTheme(id, testEdit.area.Name);

                    return(RedirectToAction("Edit", new { id }));
                }
                if (!string.IsNullOrEmpty(addGroup))
                {
                    testFacade.AddStudentGroup(id, testEdit.group);
                    return(RedirectToAction("Edit", new { id }));
                }
            }
            catch
            {
                return(RedirectToAction("Edit", new { id }));
            }
            return(RedirectToAction("Index"));
        }
 public ActionResult Save(EditTestModel model)
 {
     return(View());
 }
Ejemplo n.º 5
0
 public void Save(EditTestModel model)
 {
     throw new NotImplementedException();
 }