public void EditTrade(string id, TradedPair pair, OrderType orderType, TradeStatus status, double size, double?executionPrice, DateTime?executionDate, double?closingPrice, DateTime?closingDate, double?stopLoss, double?takeProfit, ReasonForEntry reason, double?swap, double?commissions, string notes, byte[] image) { var trade = this.tradesDB.Trades.FirstOrDefault(t => t.Id == id); if (trade == null) { return; } trade.Id = id; trade.TradePair = pair; trade.OrderType = orderType; trade.TradeStatus = status; trade.Quantity = size; trade.ExecutionPrice = executionPrice; trade.ExecutionDate = executionDate; trade.ClosingPrice = closingPrice; trade.ClosingDate = closingDate; trade.StopLoss = stopLoss; trade.TakeProfit = takeProfit; trade.ReasonForEntry = reason; trade.Swap = swap; trade.Commissions = commissions; trade.Notes = notes; trade.Image = image; this.tradesDB.SaveChanges(); }
public void AddTrade(TradedPair pair, OrderType orderType, TradeStatus status, double size, double?executionPrice, DateTime?executionDate, double?closingPrice, DateTime?closingDate, double?stopLoss, double?takeProfit, ReasonForEntry reason, double?swap, double?commissions, string notes, byte[] image) { var trade = new Trade { TradePair = pair, OrderType = orderType, TradeStatus = status, Quantity = size, ExecutionPrice = executionPrice, ExecutionDate = executionDate, ClosingPrice = closingPrice, ClosingDate = closingDate, StopLoss = stopLoss, TakeProfit = takeProfit, ReasonForEntry = reason, Swap = swap, Commissions = commissions, Notes = notes, Image = image }; this.tradesDB.Trades.Add(trade); this.tradesDB.SaveChanges(); }