Example #1
0
        public async Task <ActionResult> Index()
        {
            var count = await _accountDbCommand.CountByOwnerAsync(User.Identity.Name);

            var accounts = await _accountDbCommand.GetListByOwnerAsync(User.Identity.Name, 0, 10);

            ViewBag.Skip       = 0;
            ViewBag.Take       = 10;
            ViewBag.TotalCount = count;
            ViewBag.HasNext    = !(count <= 10);
            ViewBag.HasPreview = false;

            return(View(Mapper.Map <IEnumerable <AccountIndexModel> >(accounts)));
        }
Example #2
0
        public async Task CountByOwnerTest(string ownerName)
        {
            var account1 = Account.NewAccount("CountByOwner1", ownerName, StorageType.Common);
            var account2 = Account.NewAccount("CountByOwner2", ownerName, StorageType.Common);
            var account3 = Account.NewAccount("CountByOwner3", "_" + ownerName, StorageType.Common);
            var account4 = Account.NewAccount("CountByOwner4", ownerName, StorageType.Common);

            await _dbCommand.CreateAsync(account1);

            await _dbCommand.CreateAsync(account2);

            await _dbCommand.CreateAsync(account3);

            await _dbCommand.CreateAsync(account4);

            var count = await _dbCommand.CountByOwnerAsync(ownerName);

            count.Is(3);
        }