private void RevertFiscalCode(string fiscalCode) { if (!new FiscalCodeValidator().Validate(fiscalCode)) { CleanFields(); return; } var revertedFiscalCode = new RevertedFiscalCode(fiscalCode); FirstName = revertedFiscalCode.FirstName; LastName = revertedFiscalCode.LastName; Sex = revertedFiscalCode.Sex; Birthdate = revertedFiscalCode.BirthDate.HasValue ? revertedFiscalCode.BirthDate.Value.ToShortDateString() : null; var town = new CityRepository().AllTown().SingleOrDefault(x => x.Area == revertedFiscalCode.Area); Town = town == null ? null : town.Name; }
private IEnumerable<Town> TownsByName(string townName) { var towns = new CityRepository().TownsByName(townName); return towns; }