コード例 #1
0
ファイル: Footer.cs プロジェクト: SuNshine2612/BooksApi
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var filterConfig = Builders <Config> .Filter.Eq(x => x.IsActive, true)
                               & Builders <Config> .Filter.Eq(x => x.Code, "bookstore");

            return(View(await _config.FindOneAsync(filterConfig)));
        }
コード例 #2
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var filterCategory = Builders <Category> .Filter.Eq(x => x.IsActive, true);

            ProjectionDefinition <Category, dynamic> projectCategory = new FindExpressionProjectionDefinition <Category, dynamic>(p => new
            {
                Code = p.Code.ToLower(),
                p.Name
            });

            var category = await _category.FilterByAsync(filterCategory, projectCategory);

            ViewBag.Category = category;

            var filterConfig = Builders <Config> .Filter.Eq(x => x.IsActive, true)
                               & Builders <Config> .Filter.Eq(x => x.Code, "bookstore");

            var config = await _config.FindOneAsync(filterConfig);

            ViewBag.Config = config;

            return(View());
        }