public async Task <ActionResult> Create() { var model = new AccountCreateModel { UsePersonalStorage = true }; var personalStorages = (await _storageDbCommand.GetListByOwnerAsync(User.Identity.Name, 0, int.MaxValue)).Where(x => x.StorageType == StorageType.Personal).ToArray(); model.PersonalSorages = personalStorages.Select(x => new SelectListItem { Text = x.Name, Value = x.Id }).ToList(); return(View("Create", model)); }
public async Task <ActionResult> Index() { var count = await _storageDbCommand.CountByOwnerAsync(User.Identity.Name); var storages = count == 0 ? new Storage[0] : (await _storageDbCommand.GetListByOwnerAsync(User.Identity.Name, 0, 10)).ToArray(); ViewBag.Skip = 0; ViewBag.Take = 10; ViewBag.TotalCount = count; ViewBag.HasNext = !(count <= 10); ViewBag.HasPreview = false; return(View(Mapper.Map <IEnumerable <StorageIndexModel> >(storages))); }
public async Task GetListByOwnerTest() { var storage1 = Storage.NewStorage("Storage1", "Owner1", StorageType.Personal); storage1.ConnectionProperties = new ConnectionProperties(@"server", "database", "user", "password"); storage1.IsSuspended = true; storage1.ThresholdLength = 20000; var storage2 = Storage.NewStorage("Storage2", "Owner1", StorageType.Personal); storage2.ConnectionProperties = new ConnectionProperties(@"server", "database", "user", "password"); storage2.IsSuspended = true; storage2.ThresholdLength = 20000; var storage3 = Storage.NewStorage("Storage3", "Owner2", StorageType.Personal); storage3.ConnectionProperties = new ConnectionProperties(@"server", "database", "user", "password"); storage3.IsSuspended = true; storage3.ThresholdLength = 20000; var storage4 = Storage.NewStorage("Storage4", "Owner1", StorageType.Personal); storage4.ConnectionProperties = new ConnectionProperties(@"server", "database", "user", "password"); storage4.IsSuspended = true; storage4.ThresholdLength = 20000; await _dbCommand.CreateAsync(storage1); await _dbCommand.CreateAsync(storage2); await _dbCommand.CreateAsync(storage3); await _dbCommand.CreateAsync(storage4); var list = (await _dbCommand.GetListByOwnerAsync("Owner1", 1, 2)).ToArray(); list.IsStructuralEqual(new[] { storage2, storage4 }); }