Example #1
0
        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)));
        }
Example #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());
        }