public void Can_delete_ledgerTransaction() { var testTransaction = this.GetTestLedgerTransaction(); _ledgerTransactionService.DeleteLedgerTransaction(testTransaction.Id); _mockRepo.Verify(x => x.Delete(testTransaction), Times.Once); _mockRepo.Verify(x => x.Save(), Times.Once); }
public IActionResult Delete(int id) { try { // TODO: get the user creating the ledger account // get the admin creating the student // var adminId = GetCurrentUserId(); // if (adminId == null) return NotFound(new { error = "User is not authenticated." }); // var admin = _dbContext.Admins.SingleOrDefault(i => i.Id == adminId); // if (admin == null) return NotFound(new { error = $"User ID {adminId} has not been found" }); _ledgerTransactionService.DeleteLedgerTransaction(id); return(new OkResult()); } catch (Exception e) { // return the error. return(BadRequest(new { Error = e.Message })); } }