Exemplo n.º 1
0
        public async Task ModifyForumRoles(ModifyForumRolesContainer container)
        {
            var forum = await Get(container.ForumID);

            if (forum == null)
            {
                throw new Exception($"ForumID {container.ForumID} not found.");
            }
            switch (container.ModifyType)
            {
            case ModifyForumRolesType.AddPost:
                await _forumRepository.AddPostRole(forum.ForumID, container.Role);

                break;

            case ModifyForumRolesType.RemovePost:
                await _forumRepository.RemovePostRole(forum.ForumID, container.Role);

                break;

            case ModifyForumRolesType.AddView:
                await _forumRepository.AddViewRole(forum.ForumID, container.Role);

                break;

            case ModifyForumRolesType.RemoveView:
                await _forumRepository.RemoveViewRole(forum.ForumID, container.Role);

                break;

            case ModifyForumRolesType.RemoveAllPost:
                await _forumRepository.RemoveAllPostRoles(forum.ForumID);

                break;

            case ModifyForumRolesType.RemoveAllView:
                await _forumRepository.RemoveAllViewRoles(forum.ForumID);

                break;

            default:
                throw new Exception("ModifyForumRoles doesn't know what to do.");
            }
        }
Exemplo n.º 2
0
 public void AddViewRole(Forum forum, string role)
 {
     _forumRepository.AddViewRole(forum.ForumID, role);
 }