示例#1
0
        public IActionResult ChangeStatus(string subscriptionId, bool isDisable)
        {
            if (subscriptionId == null)
            {
                return(BadRequest("SubscriptionId must not be null."));
            }

            int result = _subscription.ChangeStatus(subscriptionId, isDisable);

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

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