public async Task <IActionResult> AllCollection() { var user = await this.userManager.GetUserAsync(this.User); var games = this.service.ListAllGameCollection(user.Id); var value = 0.0m; foreach (var game in games) { var resValue = 0.0m; var parse = decimal.TryParse(game.Value.Replace("\n", string.Empty).Replace('$', ' ').Trim(), out resValue); value += resValue; } var viewModel = new AllGameCollectionViewModel { GameCollectionItems = games, CollectionValue = value, TotalYouPaid = games.Sum(a => a.Cost), }; viewModel.CollectionValue = Math.Round(viewModel.CollectionValue, 3); viewModel.TotalYouPaid = Math.Round(viewModel.TotalYouPaid, 3); return(this.View(viewModel)); }
public async Task <IActionResult> All() { var user = await this.userManager.GetUserAsync(this.User); var games = this.service.ListAllGameWishlist(user.Id); var viewModel = new AllGameCollectionViewModel { GameCollectionItems = games }; return(this.View(viewModel)); }