public void AddToCourse(string courseId, WrapperVM <string> postTextObject) { string currentUserId = httpContextAccessor.HttpContext.GetCurrentUserId(); Course course = courseService.GetById(courseId); Person person = peopleService.GetById(currentUserId); forumPostService.AddPostTo(postTextObject.Value, course, person); forumPostService.CommitChanges(); }
public void AddAdminTo(string courseId, WrapperVM <string> adminId) { if (peopleService.IsAdminOfCourse(adminId.Value, courseId)) { throw new ApplicationException("This user is already admin of the course"); } var newAdmin = peopleService.GetById(adminId.Value); courseService.AddAdmin(newAdmin, courseId); courseService.CommitChanges(); }