public DeleteScheduledTradeResponse DeleteScheduledTrade(DeleteScheduledTradeRequest request) { DeleteScheduledTradeResponse response = new DeleteScheduledTradeResponse { Success = true, Error = "" }; Trade_Trades trade = db.Trade_Trades.FirstOrDefault(t => t.TradeNr == request.TradeNr && t.UserNr == request.UserNr); if (trade == null) { response.Success = false; response.Error = "No such trade found"; return(response); } List <Trade_Criteria> criterias = db.Trade_Criteria.Where(c => c.TradeNr == trade.TradeNr).ToList(); try { db.Trade_Criteria.RemoveRange(criterias); db.Trade_Trades.Remove(trade); db.SaveChanges(); } catch (Exception e) { _logger.ErrorFormat($"error happend error: {e.Message} stacktrace: {e.StackTrace}"); response.Success = false; response.Error = "An error occured in user creation please check logs for more details"; } return(response); }
public DeleteScheduledTradeResponse DeleteScheduledTrade(DeleteScheduledTradeRequest request) { request.UserNr = _accountFacade.GetUserAuthenticationData().UserNr; DeleteScheduledTradeResponse response = _client.DeleteScheduledTrade(request); return(response); }
public DeleteScheduledTradeResponse DeleteScheduledTrade(DeleteScheduledTradeRequest request) { RestRequest restRequest = new RestRequest("Trade/DeleteScheduledTrade", Method.POST); restRequest.AddJsonBody(request); DeleteScheduledTradeResponse response = _client.Execute <DeleteScheduledTradeResponse>(restRequest).Data; return(response); }
public DeleteScheduledTradeResponse DeleteScheduledTrade([FromBody] DeleteScheduledTradeRequest request) { DeleteScheduledTradeResponse response = _tradeFacade.DeleteScheduledTrade(request); return(response); }