public async Task <IActionResult> OnDeleteTransaction(int transactionID) { if (transactionID > 0) { List <Transaction> transactions = await TransactionDB.GetAsync(transactionID); TransactionDB.Delete(transactions[0]); } return(RedirectToAction("Blacklist")); }
public async Task <IActionResult> OnCancelTransaction(int cancelTransactionID) { if (cancelTransactionID > 0) { List <Transaction> transactions = await TransactionDB.GetAsync(cancelTransactionID); TransactionDB.Cancel(transactions[0]); } return(RedirectToAction("Blacklist")); }
public async Task <ActionResult <HttpResponseMessage> > Delete(int transaction_id) // not sure about "Item" { if (transaction_id > 0) { List <Transaction> transactions = await TransactionDB.GetAsync(transaction_id); TransactionDB.Cancel(transactions[0]); return(StatusCode(204)); } else { return(StatusCode(400)); } }
public async Task <ActionResult> CancelTransaction(int transaction_uuid) { List <Transaction> transaction = await TransactionDB.GetAsync(transaction_uuid); var result = (transaction[0].book_date - DateTime.Now).TotalHours; if (result <= 0) { TempData["CancelSucceed"] = "1"; return(RedirectToAction("Index", "User")); } if (result <= 1) { TempData["CancelSucceed"] = "2"; return(RedirectToAction("Index", "User")); } TransactionDB.Cancel(transaction[0]); TempData["CancelSucceed"] = "0"; return(RedirectToAction("Index", "User")); }