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.");
            }
        }
Beispiel #2
0
        public void ModifyForumRoles(ModifyForumRolesContainer container)
        {
            var forum = Get(container.ForumID);

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

            case ModifyForumRolesType.RemovePost:
                RemovePostRole(forum, container.Role);
                break;

            case ModifyForumRolesType.AddView:
                AddViewRole(forum, container.Role);
                break;

            case ModifyForumRolesType.RemoveView:
                RemoveViewRole(forum, container.Role);
                break;

            case ModifyForumRolesType.RemoveAllPost:
                RemoveAllPostRoles(forum);
                break;

            case ModifyForumRolesType.RemoveAllView:
                RemoveAllViewRoles(forum);
                break;

            default:
                throw new Exception("ModifyForumRoles doesn't know what to do.");
            }
        }
        public async Task <NoContentResult> ModifyForumRoles(ModifyForumRolesContainer container)
        {
            await _forumService.ModifyForumRoles(container);

            return(NoContent());
        }
Beispiel #4
0
 public NoContentResult ModifyForumRoles(ModifyForumRolesContainer container)
 {
     _forumService.ModifyForumRoles(container);
     return(NoContent());
 }