Exemple #1
0
        public async Task MakeHistory(int userId)
        {
            var cardRequest = await _cardRequestService.GetByUserId(userId);

            CardRequestHistory cardRequestHistory = new CardRequestHistory
            {
                CardRequestId = cardRequest.Id,
                CreatedAt     = cardRequest.CreatedAt,
                RequestStatus = cardRequest.CardRequestStatus
            };

            await Add(cardRequestHistory);
        }
Exemple #2
0
        public async Task <IActionResult> Index(string order = "Id", bool ascend = true)
        {
            User user = await userManager.GetUserAsync(User);

            List <Card> cards = await cardService.GetCardsAsync(user.Id);

            List <Transactions> transactions = await transactionsService.TransactionsByUserId(user.Id);

            var result = await _cardRequestService.GetByUserId(user.Id);

            if (result != null)
            {
                ViewData["cardRequest"] = result;
                ViewBag.ShowInfo        = true;
            }
            else
            {
                ViewBag.ShowInfo = false;
            }

            PropertyInfo property = typeof(Transactions).GetProperty(order);

            if (property != null)
            {
                if (ascend)
                {
                    ViewData["transact"] = transactions.OrderBy(x => property.GetValue(x)).ToList();
                }
                else
                {
                    ViewData["transact"] = transactions.OrderByDescending(x => property.GetValue(x)).ToList();
                }
            }
            else
            {
                ViewData["transact"] = transactions.OrderBy(x => x.Id).ToList();
            }

            ViewData["orderInfo"] = new Tuple <string, bool>(order, ascend);

            ViewData["userId"] = user.Id;
            return(View(cards));
        }