Exemplo n.º 1
0
        public IActionResult ChangeStatus(string topicId, bool isDisable)
        {
            if (topicId == null)
            {
                return(BadRequest("TopicId must not be null."));
            }

            int result = _topic.ChangeStatus(topicId, isDisable);

            if (result == 0)
            {
                return(BadRequest("Faulthy TopicId."));
            }
            if (result == 1)
            {
                return(NotFound("Topic not found"));
            }

            return(isDisable ? Ok("Topic is disabled.")
                : Ok("Topic is enabled."));
        }