public async Task <ActionResult> DeletePromotionDiscountItem(Guid id, PromotionDiscountItemDetailsViewModel request)
        {
            if (!ModelState.IsValid)
            {
                Alert("Bad Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(RedirectToAction(nameof(PromotionDiscountItemDetails), new { id = request.PromotionDiscountId }));
            }
            if (id == null)
            {
                Alert($"Invalid Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(RedirectToAction(nameof(PromotionDiscountItemDetails), new { id = request.PromotionDiscountId }));
            }
            try
            {
                var result = await _promotionDiscountItemService.Delete(id);

                if (!result.Success)
                {
                    Alert($"Error! {result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                    return(RedirectToAction(nameof(PromotionDiscountItemDetails), new { id = request.PromotionDiscountId }));
                }
                Alert($"Discount Item Deleted Successfully", NotificationType.success, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(RedirectToAction(nameof(PromotionDiscountItemDetails), new { id = request.PromotionDiscountId }));
            }
            catch
            {
                Alert($"Error Occurred While processing the request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(RedirectToAction(nameof(PromotionDiscountItemDetails), new { id = request.PromotionDiscountId }));
            }
        }
        public async Task <ActionResult> DeletePromotionDiscountItem(Guid id)
        {
            if (id == null)
            {
                Alert($"Invalid Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(View());
            }

            var promotionDiscountItem = new PromotionDiscountItemDetailsViewModel();

            try
            {
                var result = await _promotionDiscountItemService.FindByIdInclusive(id, x => x.Include(p => p.PromotionDiscount));

                if (!result.Success)
                {
                    Alert($"Error! {result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                    return(View(promotionDiscountItem));
                }
                promotionDiscountItem.ParentProductQuantity = result.Data.ParentProductQuantity;
                promotionDiscountItem.FreeOfChargeQuantity  = result.Data.FreeOfChargeQuantity;
                promotionDiscountItem.Id                  = result.Data.Id;
                promotionDiscountItem.DiscountRate        = result.Data.DiscountRate;
                promotionDiscountItem.EffectiveDate       = result.Data.EffectiveDate;
                promotionDiscountItem.EndDate             = result.Data.EndDate;
                promotionDiscountItem.DateCreated         = result.Data.CreatedAt;
                promotionDiscountItem.DateLastUpdated     = result.Data.LastUpdated;
                promotionDiscountItem.ProductName         = result.Data.PromotionDiscount.Product.Name;
                promotionDiscountItem.PromotionDiscountId = result.Data.PromotionDiscountId;
                return(View(promotionDiscountItem));
            }
            catch (Exception ex)
            {
                Alert($"Error! {ex.Message}", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(View(promotionDiscountItem));
            }
        }