public int NewIncome(Income income)
 {
     using (db = new ApartmentAutomationEntities())
     {
         db.Income.Add(income);
         return(db.SaveChanges());
     }
 }
Esempio n. 2
0
 public void NewHouse(House house)
 {
     using (db = new ApartmentAutomationEntities())
     {
         db.House.Add(house);
         db.SaveChanges();
     }
 }
 public void NewApartment(Apartment apartment)
 {
     using (db = new ApartmentAutomationEntities())
     {
         db.Apartment.Add(apartment);
         db.SaveChanges();
     }
 }
 public int NewExpanse(Expanse expanse)
 {
     using (db = new ApartmentAutomationEntities())
     {
         db.Expanse.Add(expanse);
         return(db.SaveChanges());
     }
 }
Esempio n. 5
0
 public int RegisterPerson(Person person)
 {
     using (db = new ApartmentAutomationEntities())
     {
         db.Person.Add(person);
         return(db.SaveChanges());
     }
 }
Esempio n. 6
0
 public void NewHost(HouseHost houseHost)
 {
     using (db = new ApartmentAutomationEntities())
     {
         db.HouseHost.Add(houseHost);
         db.SaveChanges();
     }
 }
 public void RemoveIncome(int incomeID)
 {
     using (db = new ApartmentAutomationEntities())
     {
         Income incomeToRemove = db.Income.FirstOrDefault(i => i.IncomeID == incomeID);
         db.Income.Remove(incomeToRemove);
         db.SaveChanges();
     }
 }
 public void RemoveExpanse(int expanseID)
 {
     using (db = new ApartmentAutomationEntities())
     {
         Expanse expanseToRemove = db.Expanse.FirstOrDefault(e => e.ExpenseID == expanseID);
         db.Expanse.Remove(expanseToRemove);
         db.SaveChanges();
     }
 }
 public void UpdateApartment(Apartment apartment)
 {
     using (db = new ApartmentAutomationEntities())
     {
         Apartment apartmentToUpdate = db.Apartment.FirstOrDefault(a => a.ApartmentID == apartment.ApartmentID);
         apartmentToUpdate.ApartmentNo      = apartment.ApartmentNo;
         apartmentToUpdate.ApartmentName    = apartment.ApartmentName;
         apartmentToUpdate.ApartmentAddress = apartment.ApartmentAddress;
         db.SaveChanges();
     }
 }
Esempio n. 10
0
 public void UpdateHouse(House house)
 {
     using (db = new ApartmentAutomationEntities())
     {
         House houseToUpdate = db.House.FirstOrDefault(h => h.HouseID == house.HouseID);
         houseToUpdate.HouseFloor  = house.HouseFloor;
         houseToUpdate.HouseNo     = house.HouseNo;
         houseToUpdate.HouseHostID = house.HouseHostID;
         db.SaveChanges();
     }
 }
Esempio n. 11
0
 public void UpdateIncome(Income income)
 {
     using (db = new ApartmentAutomationEntities())
     {
         Income incomeToUpdate = db.Income.FirstOrDefault(i => i.IncomeID == income.IncomeID);
         incomeToUpdate.IncomeName        = income.IncomeName;
         incomeToUpdate.IncomeDescription = income.IncomeDescription;
         incomeToUpdate.IncomePrice       = income.IncomePrice;
         income.IncomeDate = income.IncomeDate;
         db.SaveChanges();
     }
 }
Esempio n. 12
0
 public void UpdateExpanse(Expanse expanse)
 {
     using (db = new ApartmentAutomationEntities())
     {
         Expanse expanseToUpdate = db.Expanse.FirstOrDefault(e => e.ExpenseID == expanse.ExpenseID);
         expanseToUpdate.ExpenseName        = expanse.ExpenseName;
         expanseToUpdate.ExpanseDescription = expanse.ExpanseDescription;
         expanseToUpdate.ExpansePrice       = expanse.ExpansePrice;
         expanseToUpdate.ExpanseDate        = expanse.ExpanseDate;
         db.SaveChanges();
     }
 }
Esempio n. 13
0
 public void UpdatePerson(Person person)
 {
     using (db = new ApartmentAutomationEntities())
     {
         Person personToUpdate = db.Person.FirstOrDefault(p => p.PersonID == person.PersonID);
         personToUpdate.PersonName     = person.PersonName;
         personToUpdate.PersonLastName = person.PersonLastName;
         personToUpdate.PersonTC       = person.PersonTC;
         personToUpdate.PersonPassword = person.PersonPassword;
         db.SaveChanges();
     }
 }
Esempio n. 14
0
 public void UpdateHost(HouseHost houseHost)
 {
     using (db = new ApartmentAutomationEntities())
     {
         HouseHost hostToUpdate = db.HouseHost.FirstOrDefault(hh => hh.HostID == houseHost.HostID);
         hostToUpdate.HostName      = houseHost.HostName;
         hostToUpdate.HostLastName  = houseHost.HostLastName;
         hostToUpdate.HostPhone     = houseHost.HostPhone;
         hostToUpdate.HostTC        = houseHost.HostTC;
         hostToUpdate.HostIsRemoved = false;
         db.SaveChanges();
     }
 }