public IActionResult AllCollection()
        {
            var userId = this.userManager.GetUserId(this.User);

            var amiibos = this.service.ListAllAmiibosCollection(userId);

            var value = 0.0m;

            foreach (var amiibo in amiibos)
            {
                var resValue = 0.0m;
                var parse    = decimal.TryParse(amiibo.Value.Replace("\n", string.Empty).Replace('$', ' ').Trim(), out resValue);
                value += resValue;
            }

            var viewModel = new AllAmiiboCollectionViewModel
            {
                AmiiboCollectionItems = amiibos,
                TotalYouPaid          = amiibos.Sum(a => a.Cost),
                CollectionValue       = value,
            };

            viewModel.TotalYouPaid = Math.Round(viewModel.TotalYouPaid, 3);
            return(this.View(viewModel));
        }
Пример #2
0
        public async Task <IActionResult> All()
        {
            var user = await this.userManager.GetUserAsync(this.User);

            var amiibos = this.service.ListAllAmiibosWishlist(user.Id);

            var viewModel = new AllAmiiboCollectionViewModel {
                AmiiboCollectionItems = amiibos
            };

            return(this.View(viewModel));
        }