public void Add(MarketLogEntryDto dto) { if (dto.ScreenshotDbId.HasValue && dto.ScreenshotDbId == 0) { dto.ScreenshotDbId = null; } this._marketLogEntryRepository.Insert(dto.MapTo <MarketLogEntry>()); }
public void Add(MarketLogEntryDto dto) { TradingDay tradingDay = _tradingDayRepository.FirstOrDefault(x => x.Day.Year == dto.TimeStamp.Year && x.Day.Month == dto.TimeStamp.Month && x.Day.Day == dto.TimeStamp.Day); if (tradingDay == null) { tradingDay = new TradingDay(); tradingDay.Day = dto.TimeStamp.Date; this._tradingDayRepository.Insert(tradingDay); } dto.TradingDayId = tradingDay.Id; this._marketLogEntryRepository.Insert(dto.MapTo <MarketLogEntry>()); }