Example #1
0
 public HttpResponseMessage DeletedPromotion(PromotionDeletedDTO promotion)
 {
     if (ModelState.IsValid)
     {
         try
         {
             Claims claims = new Claims().Values();
             promotion.UserSystemId = claims.userSystemId;
             DeletedPromotionCommand command = new DeletedPromotionCommand();
             command.PromotionIntegrationCode = promotion.PromotionIntegrationCode;
             command.UserSystemId             = promotion.UserSystemId;
             command.UserSessionId            = promotion.UserSessionId;
             bus.Send(command);
         }
         catch (Exception ex)
         {
             return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex));
         }
     }
     return(Request.CreateResponse(HttpStatusCode.OK, new { }));
 }
Example #2
0
        public void Handle(DeletedPromotionCommand command)
        {
            PromotionDeletedDTO promotion = new PromotionDeletedDTO()
            {
                PromotionIntegrationCode = command.PromotionIntegrationCode,
                UserSessionId            = command.UserSessionId,
                UserSystemId             = command.UserSystemId
            };


            var _clientPromotion = new HttpClient();

            _clientPromotion.BaseAddress = new Uri(CustomConfiguration.WebApiPromotion);
            var resultTask = _clientPromotion.PostAsJsonAsync("api/Promotion/DeletedPromotion", promotion).Result;

            if (!resultTask.IsSuccessStatusCode)
            {
                LogManager.Error("Failure deleted Promotion. Status: " + resultTask.StatusCode);
                throw new Exception("Failure deleted Promotion. Status: " + resultTask.StatusCode);
            }
        }