Ejemplo n.º 1
0
        // GET: Tier
        public async Task <ActionResult> Index()
        {
            var tiers = new List <ListTierViewModel>();

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

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

                foreach (var tier in result.Data)
                {
                    tiers.Add(new ListTierViewModel
                    {
                        Id              = tier.Id,
                        Code            = tier.Code,
                        Description     = tier.Description,
                        Name            = tier.Name,
                        DateCreated     = tier.CreatedAt,
                        DateLastUpdated = tier.LastUpdated
                    });
                }

                return(View(tiers));
            }
            catch (Exception ex)
            {
                Alert($"Error! {ex.Message}", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(View(tiers));
            }
        }
Ejemplo n.º 2
0
        // GET: Anchors/Create
        public async Task <ActionResult> Create()
        {
            var tiersResult = await _tierService.FindAll();

            if (!tiersResult.Success)
            {
                Alert($"{tiersResult.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                ViewBag.Tiers = null;
            }
            else
            {
                ViewBag.Tiers = tiersResult.Data;
            }

            var countryResult = await _countryService.FindAll();

            if (!countryResult.Success)
            {
                Alert($"{tiersResult.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                ViewBag.Countries = null;
            }
            else
            {
                ViewBag.Countries = countryResult.Data;
            }

            var etypeResult = await _entityTypeService.FindAll();

            if (!etypeResult.Success)
            {
                Alert($"{etypeResult.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                ViewBag.EntityTypes = null;
            }
            else
            {
                ViewBag.EntityTypes = etypeResult.Data;
            }
            return(View());
        }