public Inhabitant(string surname, string phone, string pesel, HouseModel house = null) { ID = id++; Surname = surname; Phone = phone; PESEL = pesel; HaveHouse = house; }
public bool AssignPeopleToHouse(int idInhabitant, int idHouse) { Inhabitant inhabitant = Inhabitants .Select(y => y) .Where(y => y.ID == idInhabitant) .FirstOrDefault(y => y.ID == idInhabitant); HouseModel house = Houses .Select(y => y) .Where(y => y.ID == idHouse) .FirstOrDefault(y => y.ID == idHouse); return(inhabitant.IsOwner(house)); }
public bool IsOwner(HouseModel house) { if (HaveHouse == null) { Console.WriteLine("This person does not have home"); return(false); } else { Console.WriteLine("This person does have home"); HaveHouse = house; return(true); } }