Example #1
0
        public async Task <ActionResult> Index(string accountName)
        {
            var account = await _accountDbCommand.FindByNameAsync(accountName);

            if (account == null)
            {
                return(HttpNotFound());
            }
            if (account.Owner != User.Identity.Name)
            {
                return(new HttpUnauthorizedResult());
            }

            var count = await _containerDbCommand.CountAsync(account);

            var containers = await _containerDbCommand.GetListAsync(account, 0, 10);

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

            return(View(Mapper.Map <IEnumerable <ContainerIndexModel> >(containers)));
        }
Example #2
0
        public async Task <IEnumerable <ContainerResponseModel> > GetListAsync([FromUri] string accountName)
        {
            var account = await CheckAccessKey(accountName);

            var count = await _containerDbCommand.CountAsync(account);

            var containers = await _containerDbCommand.GetListAsync(account, 0, count);

            return(Mapper.Map <IEnumerable <ContainerResponseModel> >(containers));
        }