Exemplo n.º 1
0
        // GET: Catalogs/Details/5
        public async Task <ActionResult> Details(Guid id)
        {
            var catalog = new CatalogDetailsViewModel();

            try
            {
                var result = await _catalogService.FindById(id);

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



                catalog.Code            = result.Data.Code;
                catalog.Id              = result.Data.Id;
                catalog.Name            = result.Data.Name;
                catalog.EffectiveDate   = result.Data.EffectiveDate;
                catalog.EndDate         = result.Data.EndDate;
                catalog.Published       = result.Data.Published ? "Yes" : "No";
                catalog.Description     = result.Data.Description;
                catalog.DateCreated     = result.Data.CreatedAt;
                catalog.DateLastUpdated = result.Data.LastUpdated;


                var entityResult = await _catalogService.GetCatalogEntity(result.Data.EntityId);

                if (entityResult.Success)
                {
                    catalog.Entity = entityResult.Data.Name;
                }

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