Example #1
0
        public IActionResult PostPromotion([FromBody] PromotionDTO promotionDTO)
        {
            _requestLogService.SaveRequest(User.Identity.GetUserId(), "POST", "api/v1/promotions", "PostPromotion");
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid fields provided, please double check the parameters"));
            }

            var newPromotion = _promotionService.AddNewPromotion(promotionDTO);

            return(CreatedAtAction(nameof(GetPromotion), new { id = newPromotion.PromotionId }, newPromotion));
        }