Exemple #1
0
        public bool Update(HouseEntity houseEntity)
        {
            try
            {
                CondominiumManagementSystemDBEntities entity = new CondominiumManagementSystemDBEntities();
                tblHouse newHouse = new tblHouse();
                newHouse.ID          = houseEntity.ID;
                newHouse.RegionID    = houseEntity.RegionID;
                newHouse.SubCityID   = houseEntity.SubCityID;
                newHouse.WoredaID    = houseEntity.WoredaID;
                newHouse.BlockNumber = houseEntity.BlockNumber;
                newHouse.FloorNumber = houseEntity.FloorNumber;
                newHouse.GovernmentTransferedDate = houseEntity.GovernmentTransferedDate;
                newHouse.HouseNumber = houseEntity.HouseNumber;
                newHouse.SiteName    = houseEntity.SiteName;

                tblHouse oldHouse = entity.tblHouses.Where(x => x.ID == houseEntity.ID).FirstOrDefault();
                entity.Entry(oldHouse).CurrentValues.SetValues(newHouse);

                entity.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Update(RegionEntity regionEntity)
        {
            try
            {
                //
                tblRegion newRegion = new tblRegion();
                newRegion.ID    = regionEntity.ID;
                newRegion.TItle = regionEntity.TItle;

                CondominiumManagementSystemDBEntities entity = new CondominiumManagementSystemDBEntities();
                tblRegion oldRegion = entity.tblRegions.Where(x => x.ID == regionEntity.ID).FirstOrDefault();

                entity.Entry(oldRegion).CurrentValues.SetValues(newRegion);
                entity.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }