public IEnumerable<QuestionEntity> GetAllTestQuestions(TestEntity test) { return questionRepository.GetAllTestQuestions(test.ToDalTest()).Select(question => question.ToBllQuestion()); }
public ActionResult NewTest(TestViewModel test) { if (!ModelState.IsValid) { ModelState.AddModelError("", "Invalid data"); return View(test); } TestEntity e = new TestEntity() { Name = test.Name, Description = test.Description, AllowedTime = test.AllowedTime, Anonymous = test.Anonymous, AuthorId = userService.GetByLogin(SessionPersister.Username).Id, CreationDate = DateTime.Now, GlobalAvailability = test.GlobalAvailability, Interview = test.Interview, QuestionCount = 0 }; testService.CreateTest(e); return RedirectToAction("Index"); }
public void StartTest(UserEntity user, TestEntity test) { usersTestsRepository.StartTest(user.ToDalUser(), test.ToDalTest()); uow.Commit(); }
public ActionResult EditTest(TestEntity e) { IEnumerable<QuestionEntity> questions = questionService.GetAllTestQuestions(e); TestEntity oldTest = testService.GetById(e.Id); e.CreationDate = oldTest.CreationDate; e.AuthorId = oldTest.AuthorId; e.QuestionCount = oldTest.QuestionCount; ViewBag.Questions = questions; ViewBag.Test = e; testService.UpdateTest(e); return View(e); }
public IEnumerable<UserEntity> GetCoauthors(TestEntity test) { return userRepository.GetCoauthors(test.ToDalTest()).Select(user => user.ToBllUser()); }
public void SetCoauthor(UserEntity user, TestEntity test) { testRepository.SetCoauthor(user.ToDalUser(), test.ToDalTest()); uow.Commit(); }
public bool AllowedUser(TestEntity test, UserEntity user) { return testRepository.AllowedUser(test.ToDalTest(), user.ToDalUser()); }
public void UpdateTest(TestEntity e) { testRepository.Update(e.ToDalTest()); uow.Commit(); }