// 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)); }