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 (bool, int) AddRelationshipWithCompany(int bm_id, int comp_id) { var existing_bm = repository.GetSingle(bm_id); if (existing_bm == null) { return(false, 1); } var existing_company = company_service.GetExistingCompany(comp_id); if (existing_company == null) { return(false, 2); } var add_company_bm_relationship = repository.AddCompanyRelatioship(new JoinCompanyBoardMember { BoardMember = existing_bm, Company = existing_company }); return(add_company_bm_relationship, 0); }