Пример #1
0
        public async Task <ActionResult> SubCategoryDetails(Guid id)
        {
            var subCategory = new SubCategoryDetailsViewModel();

            try
            {
                var result = await _subCategoryService.FindByIdInclusive(id, x => x.Include(p => p.Category));

                if (!result.Success)
                {
                    Alert($"Error! {result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                    return(View(subCategory));
                }
                subCategory.Code            = result.Data.Code;
                subCategory.Id              = result.Data.Id;
                subCategory.Name            = result.Data.Name;
                subCategory.Description     = result.Data.Description;
                subCategory.DateCreated     = result.Data.CreatedAt;
                subCategory.DateLastUpdated = result.Data.LastUpdated;
                subCategory.CategoryName    = result.Data.Category.Name;
                subCategory.CategoryId      = result.Data.Category.Id;
                return(View(subCategory));
            }
            catch (Exception ex)
            {
                Alert($"Error! {ex.Message}", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(View(subCategory));
            }
        }