// GET: Files // List all files of the user and how much space he already used. public ActionResult Index() { var userId = User.Identity.GetUserId(); var user = db.Users.Find(userId); var model = new FilesIndexViewModel(); var userFiles = user.Files; model.SpaceUsedOverAvailable = UserFile.GetSpaceUsedOverAvailable(userFiles); var fileViewModels = new List <UserFileIndexViewModel>(); foreach (UserFile file in userFiles) { fileViewModels.Add(file.GetIndexViewModel()); } model.Files = fileViewModels; return(View(model)); }
public ActionResult Index(int?section, int?page) { var fileSectionDictionary = _homeService.GetFileSectionDictianary(); var sectionNumber = (section ?? 1); if (sectionNumber > fileSectionDictionary.Count) { sectionNumber = fileSectionDictionary.Count; } var files = _fileService.GetFilesForSection(sectionNumber); const int pageSize = 10; var pageInfo = new PageInfo { PageSize = pageSize, TotalItems = files.Count }; var pageNumber = (page ?? 1); if (pageNumber > pageInfo.TotalPages) { pageNumber = pageInfo.TotalPages; } pageInfo.PageNumber = pageNumber; var filesPerPages = files.Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList(); var viewModel = new FilesIndexViewModel { Files = filesPerPages, PageInfo = pageInfo, FileSectionDictionary = fileSectionDictionary, SectionNumber = sectionNumber }; return(View(viewModel)); }
public async Task <ActionResult> Index() { FilesIndexViewModel viewModel = new FilesIndexViewModel(); viewModel.MainSchemaLastUpdated = await db.GetGameFileLastModifiedDateAsync(GameFile.MainSchema); viewModel.HeroAbilitiesLastUpdated = await db.GetGameFileLastModifiedDateAsync(GameFile.HeroAbilities); viewModel.HeroesLastUpdated = await db.GetGameFileLastModifiedDateAsync(GameFile.Heroes); viewModel.InGameItemsLastUpdated = await db.GetGameFileLastModifiedDateAsync(GameFile.InGameItems); viewModel.ItemAbilitiesLastUpdated = await db.GetGameFileLastModifiedDateAsync(GameFile.ItemAbilities); viewModel.PanoramaLocalizationLastUpdated = await db.GetGameFileLastModifiedDateAsync(GameFile.PanoramaLocalization); viewModel.PublicLocalizationLastUpdated = await db.GetGameFileLastModifiedDateAsync(GameFile.PublicLocalization); viewModel.MainSchemaLocalizationLastUpdated = await db.GetGameFileLastModifiedDateAsync(GameFile.MainSchemaLocalization); return(View(viewModel)); }