public void DeletesAllStockDataInformationForThatCompany(Company2 company2) { var stockPriceInstance = _context.StockPrices.Where(x => x.ComapnyId == company2.Id).FirstOrDefault(); _context.StockPrices.Remove(stockPriceInstance); _context.SaveChanges(); }
public void DeletesStockDataSpecificDayInformation(Company2 company2, DateTime date) { var StockPriceInstance = _context.StockPrices.Where(x => x.ComapnyId == company2.Id && x.TradingDay == date).FirstOrDefault(); _context.StockPrices.Remove(StockPriceInstance); _context.SaveChanges(); }
//private IGetCruise _getCruise; //public InjectionTest(IGetCruise getCruise) //{ // _getCruise = getCruise; //} public List <CruiseDTO> GetCruises(CruiseRequestDTO request) { //TODO: This method receives a generic request, that has a cruise company code on it //There is an interface (IGetCruise) that is implemented by 3 classes (Company1, Company2 and Company3) //Make sure that the correct class is injected based on the CruiseCompanyCode on the request //without directly referencing the 3 classes and the method GetCruises of the chosen implementation is called var list = new List <CruiseDTO>(); if (request.CruiseCompanyCode == 1) { Company1 company1 = new Company1(); list = company1.GetCruises(request); } else if (request.CruiseCompanyCode == 2) { Company2 company2 = new Company2(); list = company2.GetCruises(request); } else if (request.CruiseCompanyCode == 3) { Company3 company3 = new Company3(); list = company3.GetCruises(request); } else { throw new System.Exception("Incorrect company code"); } return(list); }
public List <CruiseDTO> GetCruises(CruiseRequestDTO request) { //TODO: This method receives a generic request, that has a cruise company code on it //There is an interface (IGetCruise) that is implemented by 3 classes (Company1, Company2 and Company3) //Make sure that the correct class is injected based on the CruiseCompanyCode on the request //without directly referencing the 3 classes and the method GetCruises of the chosen implementation is called List <CruiseDTO> result = null; switch (request.CruiseCompanyCode) { case 1: result = new Company1().GetCruises(request); break; case 2: result = new Company2().GetCruises(request); break; case 3: result = new Company3().GetCruises(request); break; default: throw new System.Exception("Company not found"); } return(result); }
public List <CruiseDTO> GetCruises(CruiseRequestDTO request) { //TODO: This method receives a generic request, that has a cruise company code on it //There is an interface (IGetCruise) that is implemented by 3 classes (Company1, Company2 and Company3) //Make sure that the correct class is injected based on the CruiseCompanyCode on the request //without directly referencing the 3 classes and the method GetCruises of the chosen implementation is called List <CruiseDTO> ListCruise = new List <CruiseDTO>(); if (request.CruiseCompanyCode.Equals(1)) { Company1 company1 = new Company1(); ListCruise = company1.GetCruises(request); } else if (request.CruiseCompanyCode.Equals(2)) { Company2 company2 = new Company2(); ListCruise = company2.GetCruises(request); } else if (request.CruiseCompanyCode.Equals(3)) { Company3 company3 = new Company3(); ListCruise = company3.GetCruises(request); } else { throw new Exception("não existe código 4"); } return(ListCruise); }
public void UpdateACompany(string Symbol, Company2 company2) { var updateCompany2 = _context.Company2s.Where(x => x.Symbol == Symbol).FirstOrDefault(); updateCompany2.Name = company2.Name; updateCompany2.Symbol = company2.Symbol; _context.SaveChanges(); }
public void CreateACompany(Company2 company2) { _context.Company2s.Add(new Company2() { Name = company2.Name, Symbol = company2.Symbol }); _context.SaveChanges(); }
public string Index2(Company2 company) { if (string.IsNullOrEmpty(company.SelectedDepartment)) { return("You did not select any department"); } else { return("You selected department with ID = " + company.SelectedDepartment); } }
public List <StockPrice> ShowSpecificStockRecords(Company2 company2, DateTime start, DateTime end) { return(_context.StockPrices.Where(x => x.ComapnyId == company2.Id && x.TradingDay >= start && x.TradingDay <= end).ToList()); }
public List <StockPrice> ShowAllStocks(Company2 company2) { return(_context.StockPrices.Where(x => x.ComapnyId == company2.Id).ToList()); }
public ActionResult Index2() { Company2 company = new Company2(); return(View(company)); }
public void UpdateACompanySer(string Symbol, Company2 company2) { _company2Repository.UpdateACompany(Symbol, company2); }
public void CreateACompanySer(Company2 company2) { _company2Repository.CreateACompany(company2); }
public void Put(string Symbol, [FromBody] Company2 company2) { _company2Service.UpdateACompanySer(Symbol, company2); }
public void Post([FromBody] Company2 company2) { _company2Service.CreateACompanySer(company2); }