Esempio n. 1
0
 public Inhabitant(string surname, string phone, string pesel, HouseModel house = null)
 {
     ID        = id++;
     Surname   = surname;
     Phone     = phone;
     PESEL     = pesel;
     HaveHouse = house;
 }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
 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);
     }
 }