public async Task <ActionResult> ShowTransactions() { var model = new TransactionViewModel(); try { var userId = User.Identity.GetUserId(); ViewBag.Balance = await model.getUserBalanceAsync(userId); ViewBag.MessagesCounter = await model.getUserUnreadMessagesAsync(userId); ViewBag.InqueriesCounter = await model.getUserUnAnsweredInqueriesAsync(userId); ViewBag.CustomerNumber = await model.getUserCustomerNumberAsync(userId); var transactions = db.transactions.Where(w => w.customer.Id == userId).OrderByDescending(o => o.CreatedDate).ToList(); foreach (var item in transactions) { model.details.Add(new TransactionDetails { CreatedDate = item.CreatedDate.ToString("dd.MM.yyyy HH:mm:ss"), Balance = item.CurrentAmount, Amount = item.amount, TransactionInfo = item.TransactionInfo.Substring(0, item.TransactionInfo.IndexOf(":")) }); } } catch (Exception) { return(HttpNotFound()); } return(PartialView(model)); }