Beispiel #1
0
        // GET: Packagings
        public async Task <ActionResult> Index()
        {
            var packagings = new List <ListPackagingViewModel>();

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

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

                foreach (var brand in result.Data)
                {
                    packagings.Add(new ListPackagingViewModel
                    {
                        Id              = brand.Id,
                        Code            = brand.Code,
                        Description     = brand.Description,
                        Name            = brand.Name,
                        DateCreated     = brand.CreatedAt,
                        DateLastUpdated = brand.LastUpdated
                    });
                }

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