public async Task <IActionResult> DELETE_CURRENCY([FromBody] DeleteCurrencyCommand command) { var res = await _mediator.Send(command); if (!res.Status.IsSuccessful) { return(BadRequest(res)); } return(Ok(res)); }
public async Task should_delete_currency() { await RunAsNewUserAsync(); var currencyId = await SendAsync(F.Create <CreateCurrencyCommand>()); var command = new DeleteCurrencyCommand { Id = currencyId }; await SendAsync(command); var currency = await FindAsync <Currency>(currencyId); currency.Should().BeNull(); }
public IActionResult DeleteCurrency([FromRoute] CurrencyId id) { var command = new DeleteCurrencyCommand { Id = id, }; try { _commandDispatcher.Dispatch(command); return(this.DeletedNoContent(id.ToString())); } catch (CurrencyNotFoundException ex) { return(this.NotFoundError(ex)); } }
public async Task <IActionResult> DeleteCurrencyAsync(int currencyId) { if (currencyId < 1) { return(Error("Invalid Currency Id")); } var userId = GetUserIdFromClaim(); _logger.LogInformation($"Deleting Currency: ${currencyId}, Requested By:${userId}"); var command = new DeleteCurrencyCommand { Id = currencyId, UserId = userId }; var result = await _messages.Dispatch(command).ConfigureAwait(false); return(Ok(result)); }
public async Task <ActionResult> DeleteCurrency([FromBody] DeleteCurrencyCommand request, CancellationToken cancellationToken) { var response = await Mediator.Send(request, cancellationToken); return(Ok(response)); }
public void DeleteDimension <TResult>(TResult obj) where TResult : class { var resultType = typeof(TResult); if (resultType == typeof(Customer)) { var command = new DeleteCustomerCommand { Customer = obj as Customer }; _processXml.Process(command.ToXml()); } if (resultType == typeof(Supplier)) { var command = new DeleteSupplierCommand { Supplier = obj as Supplier }; _processXml.Process(command.ToXml()); } if (resultType == typeof(BalanceSheet)) { var command = new DeleteGeneralLedgerCommand { GeneralLedger = obj as BalanceSheet }; _processXml.Process(command.ToXml()); } if (resultType == typeof(ProfitLoss)) { var command = new DeleteGeneralLedgerCommand { GeneralLedger = obj as ProfitLoss }; _processXml.Process(command.ToXml()); } if (resultType == typeof(CostCenter)) { var command = new DeleteCostCenterCommand { CostCenter = obj as CostCenter }; _processXml.Process(command.ToXml()); } if (resultType == typeof(Article)) { var command = new DeleteArticleCommand { Article = obj as Article }; _processXml.Process(command.ToXml()); } if (resultType == typeof(Vat)) { var command = new DeleteVatCommand { Vat = obj as Vat }; _processXml.Process(command.ToXml()); } if (resultType == typeof(Currency)) { var command = new DeleteCurrencyCommand { Currency = obj as Currency }; _processXml.Process(command.ToXml()); } }
public async Task <IActionResult> Delete([FromBody] DeleteCurrencyCommand command) { return(await Execute(command)); }