public static Quotation FromDto(QuotationDto dto) { var quotation = new Quotation(); quotation.Id = dto.Id; quotation.Date = dto.PriceDate; quotation.AssetId = dto.AssetId; quotation.Open = dto.OpenPrice; quotation.High = dto.HighPrice; quotation.Low = dto.LowPrice; quotation.Close = dto.ClosePrice; quotation.Volume = dto.Volume; return quotation; }
public QuotationDto ToDto() { var dto = new QuotationDto { Id = this.Id, AssetId = this.AssetId, PriceDate = this.Date, OpenPrice = this.Open, HighPrice = this.High, LowPrice = this.Low, ClosePrice = this.Close, Volume = this.Volume, TimeframeId = 1 }; return dto; }
public void UpdateQuotation(QuotationDto quotation, string symbol) { string tableName = QuotationsTablePrefix + symbol; string sql = "UPDATE fx." + tableName + " SET " + " OpenPrice = " + quotation.OpenPrice.ToDbString() + ", HighPrice = " + quotation.HighPrice.ToDbString() + ", LowPrice = " + quotation.LowPrice.ToDbString() + ", ClosePrice = " + quotation.ClosePrice.ToDbString() + ", Volume = " + quotation.Volume.ToDbString() + " WHERE QuotationId = " + quotation.Id; using (var context = new EFDbContext()) { context.Database.ExecuteSqlCommand(sql); context.SaveChanges(); } }