public IActionResult CreateTransaction(CreateTransactionViewModel ctvm, string information) { User current = users.Users.Where(l => l.UserName == HttpContext.User.Identity.Name).FirstOrDefault(); if (ModelState.IsValid) { Transaction t = new Transaction(); t.Amount = ctvm.Amount; t.AcountId = current.AcountID; t.AmountWanted = ctvm.AmountWanted; t.CurrencyType = ctvm.CurrencyType; t.CurrrencyWanted = ctvm.CurrrencyWanted; t.TransactionDescription = ctvm.TransactionDescription; t.TransactionInfo = information; t.TransactionTitle = ctvm.TransactionTitle; t.UserName = current.UserName; t.Wallet = ctvm.Wallet; repository.SaveTransaction(t); TempData["message"] = $"{t.TransactionTitle} has been created"; return(RedirectToAction("List1")); } else { CreateTransactionViewModel CTVM = new CreateTransactionViewModel { // NewTransaction = ctvm.NewTransaction, TransactionWallets = wallets.Wallets.Where(p => p.UserID == current.AcountID), SupportedWallets = supportedCurency }; if (CTVM.TransactionWallets == null) { TempData["message"] = "You must import a wallet before you can create a transaction"; return(View("List", repository.Transactions)); } return(View(CTVM)); } //} //else //{ TempData["message"] = "Invalid Wallet Selected"; return(View(ctvm)); //} }