private void AddPosTrade(int posID, int tradeID) { PosTrade pt = new PosTrade(posID, tradeID); pt.IsNew = true; _posTrades.Add(pt); }
/// <summary> /// Add PosTrade relation /// </summary> /// <param name="posID">Position id</param> /// <param name="tradeID">Trade id</param> public void AddPosTrade(int posID, int tradeID) { PosTrade pt = new PosTrade(posID, tradeID); using (var db = new DaContext(_options)) { db.PosTrade.Add(pt); db.SaveChanges(); } }
public void AddPosTrade(int posID, int tradeID) { if (_posTrades.Any(r => r.PosID == posID && r.TradeID == tradeID)) { throw new Exception("dublicate"); } PosTrade pt = new PosTrade(posID, tradeID); _posTrades.Add(pt); }