public int GetExpectedIncome(long tin) { IRepository <Client> clientRepository = new ClientRepository(); ImportRepository importsRepository = new ImportRepository(); var client = clientRepository.FindById(tin); var imports = importsRepository.FindByClientId(tin); int discount = client.Discount; int expectedIncome = 0; foreach (var i in imports) { if (i.IsStored) { var elapsed = i.DepartureDate.Subtract(i.EntryDate); int days = Convert.ToInt32(elapsed.TotalDays); int income = 2 * i.PriceByUnit / (100 - discount); income = income * days; expectedIncome += income; } } return(expectedIncome); }