Esempio n. 1
0
        // GET: Pricing
        public async Task <ActionResult> Index()
        {
            var pricing = new List <ListPricingViewModel>();

            try
            {
                var result = await _pricingService.FindAll();

                if (!result.Success)
                {
                    Alert($"{result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                    return(View(pricing));
                }

                foreach (var price in result.Data)
                {
                    pricing.Add(new ListPricingViewModel
                    {
                        Id              = price.Id,
                        Code            = price.Code,
                        Tier            = price.Tier.Name,
                        Product         = price.Product.Name,
                        DateCreated     = price.CreatedAt,
                        DateLastUpdated = price.LastUpdated
                    });
                }

                return(View(pricing));
            }
            catch (Exception ex)
            {
                Alert($"Error! {ex.Message}", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(View(pricing));
            }
        }