public async Task <IViewComponentResult> InvokeAsync(short?id)
        {
            var fileCategory = new FileCategory();

            if (id != null)
            {
                fileCategory = await _fileCategoryService.GetAll().AsNoTracking().FirstOrDefaultAsync(fileCategory => fileCategory.Id == id);
            }
            var dictionary = new SelectList(await _fileCategoryService.GetDictionaryAsync(), "Key", "Value", id);

            return(View(new Tuple <FileCategory, SelectList>(fileCategory, dictionary)));
        }
Beispiel #2
0
        public async Task <IViewComponentResult> InvokeAsync(short selectedId, string selectFileCategoryCls)
        {
            var fileCategorys = await _fileCategory.GetAll().Where(fc => fc.ParentId == null).Include(f => f.Children).ThenInclude(f => f.Children).ThenInclude(f => f.Children).ThenInclude(f => f.Children).ThenInclude(f => f.Children).ToListAsync();

            return(View(new Tuple <List <FileCategory>, short, string>(fileCategorys, selectedId, selectFileCategoryCls)));
        }
Beispiel #3
0
        public async Task <IActionResult> FileCategory()
        {
            var fileCategoryes = _fileCategoryService.GetAll().Include(m => m.Parent).Include(m => m.Children).ThenInclude(fc => fc.Children).ThenInclude(fc => fc.Children).ThenInclude(fc => fc.Children).ThenInclude(fc => fc.Children).AsNoTracking();

            return(View(await fileCategoryes.Where(m => m.Parent == null).ToListAsync()));
        }