예제 #1
0
        public async Task <IHttpActionResult> UnwatchPost(HidePostViewModel post)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var userAndOrg = GetUserAndOrganization();

            try
            {
                await _postService.ToggleWatchAsync(post.Id, userAndOrg, false);
            }
            catch (ValidationException e)
            {
                return(BadRequestWithError(e));
            }
            return(Ok());
        }
예제 #2
0
        public IHttpActionResult WatchPost(HidePostViewModel post)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var userAndOrg = GetUserAndOrganization();

            try
            {
                _postService.ToggleWatch(post.Id, userAndOrg, true);
            }
            catch (ValidationException e)
            {
                return(BadRequestWithError(e));
            }

            return(Ok());
        }
예제 #3
0
        public IHttpActionResult HidePost(HidePostViewModel post)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var userAndOrg = GetUserAndOrganization();

            try
            {
                _postService.HideWallPost(post.Id, userAndOrg);
                return(Ok());
            }
            catch (UnauthorizedException)
            {
                return(BadRequest());
            }
            catch (ValidationException e)
            {
                return(BadRequestWithError(e));
            }
        }