public Task <FilterResultModel <AccountCategoryView> > Handle(GetAccountCategoryListQuery request, CancellationToken cancellationToken)
        {
            var sortBy        = request.SortBy.Trim() != "" ? request.SortBy : "CategoryName";
            var sortDirection = (request.SortDirection.ToUpper() == "DESCENDING") ? true : false;

            FilterResultModel <AccountCategoryView> result = new FilterResultModel <AccountCategoryView> ();

            var categoryList = _database.AccountCatagory
                               .Select(AccountCategoryView.Projection)
                               .Select(DynamicQueryHelper.GenerateSelectedColumns <AccountCategoryView> (request.SelectedColumns))
                               .AsQueryable();

            if (request.Filter.Count() > 0)
            {
                categoryList = categoryList
                               .Where(DynamicQueryHelper
                                      .BuildWhere <AccountCategoryView> (request.Filter)).AsQueryable();
            }
            result.Count = categoryList.Count();

            result.Items = categoryList.OrderBy(sortBy, sortDirection).Skip(request.PageNumber)
                           .Take(request.PageSize)
                           .ToList();

            return(Task.FromResult <FilterResultModel <AccountCategoryView> > (result));
        }
        public async Task ReturnListOfAccountCategoryView()
        {
            // Arrange
            GetAccountCatugoryQueryListQueryHandler handler = new GetAccountCatugoryQueryListQueryHandler(_Database);
            GetAccountCategoryListQuery             query   = new GetAccountCategoryListQuery();

            // Act
            var result = await handler.Handle(query, CancellationToken.None);

            // Assert
            Assert.True(result.Items.Count() > 0);
        }
        public async Task <ActionResult <FilterResultModel <AccountCategoryView> > > GetAccountCategoryList([FromQuery] GetAccountCategoryListQuery query)
        {
            var result = await _Mediator.Send(query);

            return(Ok(result));
        }