private IEnumerable <StockPrice> GetStockPriceList() { var cse = new StockExchangeCompanies { CompanyId = 1, StockExchangeId = "BSE" }; return(new List <StockPrice> { new StockPrice { Id = 1, CurrentPrice = 100, Date = new DateTime().ToShortDateString(), Time = new DateTime().ToShortTimeString(), StockExchangeCompanies = cse }, new StockPrice { Id = 2, CurrentPrice = 101, Date = new DateTime().ToShortDateString(), Time = new DateTime().AddMinutes(1).ToShortTimeString(), StockExchangeCompanies = cse } }); }
public IActionResult Post(StockCompanyDto entity) { StockExchangeCompanies s = new StockExchangeCompanies(); s.CompanyId = Int16.Parse(entity.companyId); s.StockExchangeId = entity.stockExchangeId; var check = repository.add(s); if (check) { return(Ok(s)); } return(BadRequest()); }