public async Task <AssetFolder> GetAssetFolderAsync(Guid id) { var entity = AssetFolders.AsQueryable().FirstOrDefault(x => x.Id == id); if (entity == null) { throw new Exception(); } return(entity.ToModel()); }
public async Task <IEnumerable <AssetFolder> > GetAssetFoldersAsync(AssetFolderQuery queryData) { var query = AssetFolders.AsQueryable(); if (queryData.RootOnly == true) { query = query.Where(x => x.Parent == null); } if (queryData.Parent != null) { query = query.Where(x => x.Parent == queryData.Parent.Value); } return(query.OrderBy(x => x.Name).ToList().Select(x => x.ToModel())); }