public bool addIPO(AddIPOModel model) { var company = _db.Companies.Where(c => c.CompanyID == model.CompanyID).FirstOrDefault(); IPODetails ipo = new IPODetails { CompanyID = model.CompanyID, Company = company, stockExchanges = model.stockExchanges, PricePerShare = model.PricePerShare, TotalAvailableShares = model.TotalAvailableShares, OpeningDate = model.OpeningDate, Remarks = model.Remarks }; var result = _db.IPODetails.Add(ipo); _db.SaveChanges(); if (result != null) { return(true); } else { return(false); } }
public IActionResult AddIPO(IPODetails iPODetails) { try { return(Ok(service.AddIPO(iPODetails))); } catch (Exception ex) { return(StatusCode(500, ex.Message)); } }
public IPODetailsDto GetExistingIPO(int comp_key, string se_key) { IPODetails ipo = repository.GetSingle(comp_key, se_key); return(new IPODetailsDto { PricePerShare = ipo.PricePerShare, TotalShares = ipo.TotalShares, OfferingDate = ipo.OfferingDateTime.ToShortDateString(), OfferingTime = ipo.OfferingDateTime.ToShortTimeString(), Remarks = ipo.Remarks, RegisteredCompanyId = ipo.RegisteredCompanyId, RegisteredStockExchangeId = ipo.RegisteredStockExchangeId }); }
public bool Add(IPODetails entity) { try { context.IPODetails.Add(entity); int updates = context.SaveChanges(); if (updates > 0) { return(true); } return(false); } catch (Exception) { return(false); } }
public (bool, int) InsertNewIPODetail(IPODetailsDto ipo_dto) { var existing_company = company_service.GetExistingCompany(ipo_dto.RegisteredCompanyId); if (existing_company == null) { return(false, 1); } var existing_stockexchange = se_service.GetExistingStockExchange(ipo_dto.RegisteredStockExchangeId); if (existing_stockexchange == null) { return(false, 2); } var ipo = new IPODetails { PricePerShare = ipo_dto.PricePerShare, TotalShares = ipo_dto.TotalShares, OfferingDateTime = Convert.ToDateTime(ipo_dto.OfferingDate + " " + ipo_dto.OfferingTime), Remarks = ipo_dto.Remarks, RegisteredCompany = existing_company, RegisteredStockExchange = existing_stockexchange }; bool add_company_se_relationship = se_service.AddRelationshipWithCompany(new JoinCompanyStockExchange { Company = existing_company, StockExchange = existing_stockexchange }); if (!add_company_se_relationship) { return(false, 3); } bool added = repository.Add(ipo); return(added, 0); }
public IActionResult Post([FromBody] IPODetailsDto entity) { if (ModelState.IsValid) { var new_item = new IPODetails { PricePerShare = entity.pricePerShare, TotalNumberOfShares = entity.totalNumberShares, OpenDateTime = Convert.ToDateTime(entity.date + " " + entity.time), Remarks = entity.remarks, CompanyId = entity.companyId, StockExchangeId = entity.stockExchangeId }; var isAdded = repository.add(new_item); if (isAdded) { return(Created("IPODETAILS", new_item)); } } return(BadRequest(ModelState)); }
public IPODetails UpdateIPO(IPODetails iPO) { context.IPODetails.Update(iPO); context.SaveChanges(); return(iPO); }
public IPODetails AddIPO(IPODetails iPO) { context.IPODetails.Add(iPO); context.SaveChanges(); return(iPO); }
public IPODetails UpdateIPO(IPODetails iPO) { return(repo.UpdateIPO(iPO)); }
public IPODetails AddIPO(IPODetails iPO) { return(repo.AddIPO(iPO)); }
public bool Update(IPODetails entity) { throw new NotImplementedException(); }