public int NewIncome(Income income) { using (db = new ApartmentAutomationEntities()) { db.Income.Add(income); return(db.SaveChanges()); } }
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()); } }
public int RegisterPerson(Person person) { using (db = new ApartmentAutomationEntities()) { db.Person.Add(person); return(db.SaveChanges()); } }
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }