Esempio n. 1
0
        public async Task <IActionResult> DeactivatePostAsync([FromBody] ActivationPost activationPost)
        {
            if (!User.IsAdmin())
            {
                return(Unauthorized());
            }
            try
            {
                await _activationService.DeactivatePost(activationPost.PostId);

                return(Ok());
            }
            catch (Exception e)
            {
                _logger.LogError($"Returning exception: {e.Message}");
                return(Json(new ExceptionDto
                {
                    Error = e.Message
                }));
            }
        }