public int SaveInsurance(int idCar, int idInsured) { Insurance insurance = new Insurance(); CarBusiness carBusiness = new CarBusiness(); InsuredBusiness insuredBusiness = new InsuredBusiness(); insurance.car = carBusiness.GetCarById(idCar); insurance.insured = insuredBusiness.GetInsuredById(idInsured); CalculateInsuranceValue(insurance); return(dalInsurance.SaveInsurance(insurance)); }
public List <Insurance> GetInsuranceByCpf(string cpf) { List <Insurance> insurances = new List <Insurance>(); CarBusiness carBusiness = new CarBusiness(); InsuredBusiness insuredBusiness = new InsuredBusiness(); insurances = dalInsurance.GetInsuranceByCpf(cpf); foreach (Insurance item in insurances) { item.car = carBusiness.GetCarById(item.car.idCar); item.insured = insuredBusiness.GetInsuredById(item.insured.idInsured); } return(insurances); }