public int CalcularPontosPorDependente(Familia familia) { var quantidadeDeDependentes = familia.Pessoas .Where(p => p.Tipo == "Dependente" && Auxiliar.CalculateAge(p.DataDeNascimento) < 18) .Count(); if (quantidadeDeDependentes >= 3) { return(3); } else if (quantidadeDeDependentes > 0) { return(2); } return(0); }
public int CalcularPontosPorIdade(Familia familia) { var pessoa = familia.Pessoas .Where(p => p.Tipo == "Pretendente") .FirstOrDefault(); if (pessoa != null) { var idade = Auxiliar.CalculateAge(pessoa.DataDeNascimento); if (idade >= 45) { return(3); } else if (idade > 30) { return(2); } else { return(1); } } return(0); }