public static Apartment New(int number, string block, IEnumerable <Dweller> dwellers) { var apartment = new Apartment(0, number, block); apartment.SetDwellers(dwellers); apartment.HasAtLeastOneDweller(); return(apartment); }
public static Apartment FromId(int id, int number, string block, IEnumerable <Dweller> dwellers) { var apartment = new Apartment(id, number, block); dwellers.ToList().ForEach(p => p.SetApartment(apartment)); apartment.Dwellers = dwellers.ToList(); apartment.HasAtLeastOneDweller(); return(apartment); }