Esempio n. 1
0
        public ActionResult DissociateProjectSubscription(
            [FromBody] DissociateProjectSubscriptionEvent dissociateProjectSubscription)
        {
            try
            {
                dissociateProjectSubscription.EffectiveDate =
                    dissociateProjectSubscription.EffectiveDate.ToMySqlDateTimeOverflowCorrection();
                dissociateProjectSubscription.ReceivedUTC = DateTime.UtcNow;

                if (subscriptionService.DissociateProjectSubscription(dissociateProjectSubscription))
                {
                    return(Ok());
                }

                logger.LogInformation("Unable to save to db. Make sure request is not duplicated and all keys exist");
                return(BadRequest("Unable to save to db. Make sure request is not duplicated and all keys exist"));
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Invalid ProjectSubscriptionUID"))
                {
                    logger.LogInformation("Invalid ProjectSubscriptionUID");
                    return(BadRequest("Invalid ProjectSubscriptionUID"));
                }

                logger.LogError(ex.Message + ex.StackTrace);
                return(StatusCode(500));
            }
        }