コード例 #1
0
        public async Task <IActionResult> DownloadPdfExpenseFixed(int id)
        {
            var user = await _userManager.GetUserAsync(User);

            DetailsAnothersExpenseFormViewModel expenseFixed = new DetailsAnothersExpenseFormViewModel()
            {
                Despesas          = await _anothersExpenseRepository.FindAllExpenseByUserAndTypeAsync(user.Id, id),
                TotalPorCategoria = await _anothersExpenseRepository.GetTotalCategoryPerUserIdAnTypeIdAsync(user.Id, id)
            };

            return(new ViewAsPdf("DownloadPdfAnotherExpense", expenseFixed)
            {
                FileName = "Demais_despesas.pdf"
            });
        }
コード例 #2
0
        public async Task <IActionResult> ExtraExpenseIndex(string id)
        {
            if (id == null)
            {
                return(RedirectToAction(nameof(Error), new { Message = "Id não informado" }));
            }

            var user = await _userManager.FindByIdAsync(id);

            if (user == null || user.Id != _userManager.GetUserId(User))
            {
                return(RedirectToAction(nameof(Error), new { Message = "Usuario não correspondido" }));
            }

            DetailsAnothersExpenseFormViewModel viewModel = new DetailsAnothersExpenseFormViewModel()
            {
                Despesas          = await _anothersExpenseRepository.FindAllExpenseByUserAndTypeAsync(user.Id, 3),
                TotalPorCategoria = await _anothersExpenseRepository.GetTotalCategoryPerUserIdAnTypeIdAsync(user.Id, 3)
            };

            return(View(viewModel));
        }