public async Task <ActionResult> CreatePromotionDiscountItem(AddPromotionDiscountItemViewModel request) { if (!ModelState.IsValid) { Alert($"Invalid Request.", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(PromotionDiscountItems), new { id = request.PromotionDiscountId })); } try { var addPromotionDiscountRequest = new AddPromotionDiscountItemRequest { PromotionDiscountId = request.PromotionDiscountId, DiscountRate = request.DiscountRate, FreeOfChargeQuantity = request.FreeOfChargeQuantity, ParentProductQuantity = request.ParentProductQuantity, EffectiveDate = request.EffectiveDate, EndDate = request.EndDate }; var result = await _promotionDiscountItemService.Create(addPromotionDiscountRequest); if (!result.Success) { Alert($"{result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(PromotionDiscountItems), new { id = request.PromotionDiscountId })); } Alert($"Discount Item Created Successfully", NotificationType.success, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(PromotionDiscountItems), new { id = request.PromotionDiscountId })); } catch (Exception ex) { Alert($"Error! {ex.Message}.", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(PromotionDiscountItems), new { id = request.PromotionDiscountId })); } }
public Task <ServiceResponse <PromotionDiscountItem> > Create(AddPromotionDiscountItemRequest request) { throw new NotImplementedException(); }