public void RemoveCurrentMember(string courseId) { string currentUserId = httpContextAccessor.HttpContext.GetCurrentUserId(); var currentMember = courseMemberService.GetMemberByUserAndCourse(currentUserId, courseId); courseMemberService.ArchiveMemberById(currentMember.Id.ToString()); courseMemberService.CommitChanges(); }
public SubmitTestVM LoadTestSubmission(string testId) { var test = courseTestService.GetWithQuestions(testId); string courseId = courseTestService.GetCourseIdOf(testId); string currentUserId = httpContextAccessor.HttpContext.GetCurrentUserId(); var courseMember = courseMemberService.GetMemberByUserAndCourse(currentUserId, courseId); var foundTestSubmission = testSubmissionService.LoadOrCreateSubmission(test, courseMember); var answersVM = foundTestSubmission.Answers.Select(answer => new SubmissionAnswerVM(answer.Question.Number, answer.Question.QuestionText, answer.Text, answer.Question.Type)); testSubmissionService.CommitChanges(); return(new SubmitTestVM(foundTestSubmission.Id.ToString(), test.Topic, foundTestSubmission.IsSubmitted, answersVM, test.IsGraded, test.Deadline)); }