コード例 #1
0
        // GET: Tier
        public async Task <ActionResult> Index()
        {
            var entityTypes = new List <ListEntityTypeViewModel>();

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

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

                foreach (var entityType in result.Data)
                {
                    entityTypes.Add(new ListEntityTypeViewModel
                    {
                        Id              = entityType.Id,
                        Code            = entityType.Code,
                        Description     = entityType.Description,
                        Name            = entityType.Name,
                        DateCreated     = entityType.CreatedAt,
                        DateLastUpdated = entityType.LastUpdated
                    });
                }

                return(View(entityTypes));
            }
            catch (Exception ex)
            {
                Alert($"Error! {ex.Message}", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(View(entityTypes));
            }
        }
コード例 #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());
        }