// GET: ProductDiscount public async Task <ActionResult> Index() { var productDiscounts = new List <ListProductDiscountViewModel>(); try { var result = await _productDiscountService.FindAll(); if (!result.Success) { Alert($"{result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View(productDiscounts)); } foreach (var productDiscount in result.Data) { productDiscounts.Add(new ListProductDiscountViewModel { Id = productDiscount.Id, Name = productDiscount.Name, CatalogueName = productDiscount.CatalogueName, CategoryName = productDiscount.CategoryName, BrandName = productDiscount.BrandName, PackagingName = productDiscount.PackagingName, ProductName = productDiscount.ProductName, EffectiveDate = productDiscount.EffectiveDate, EndDate = productDiscount.EndDate, DateCreated = productDiscount.CreatedAt, DateLastUpdated = productDiscount.LastUpdated }); } return(View(productDiscounts)); } catch (Exception ex) { Alert($"Error! {ex.Message}", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View(productDiscounts)); } }