Beispiel #1
0
 public City GetCityById(int Id)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from c in context.Cities.Include(c => c.Province) where c.Id == Id select c).FirstOrDefault());
     }
 }
Beispiel #2
0
 public List <City> GetCitys()
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from c in context.Cities.Include(c => c.Province) select c).ToList());
     }
 }
 public PropertyType GetPropertyType(int Id)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from pt in context.PropertyTypes where pt.Id == Id select pt).FirstOrDefault());
     }
 }
 public List <Province> GetProvinces()
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from c in context.Provinces.Include(c => c.Country) select c).ToList());
     }
 }
 public Province GetProvinceById(int Id)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from c in context.Provinces.Include(c => c.Country) where c.Id == Id select c).FirstOrDefault());
     }
 }
Beispiel #6
0
 public List <Role> GetRole()
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from u in context.Roles select u).ToList());
     }
 }
 public List <Country> GetCountries()
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from c in context.Countries select c).ToList());
     }
 }
 public List <PropertyType> GetPropertyTypes()
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from pt in context.PropertyTypes select pt).ToList());
     }
 }
 public Country GetCountryById(int Id)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from c in context.Countries where c.Id == Id select c).FirstOrDefault());
     }
 }
Beispiel #10
0
 public List <User> GetUsers()
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from u in context.Users select u).ToList());
     }
 }
Beispiel #11
0
 public void DeleteCity(City entity)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.Remove(entity);
         context.SaveChanges();
     }
 }
 public void UpdateCountry(Country entity, int Id)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.Countries.Update(entity);
         context.SaveChanges();
     }
 }
 public void AddCountry(Country entity)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.Countries.Add(entity);
         context.SaveChanges();
     }
 }
 public List <PropertyFeature> GetFeatures()
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from f in context.PropertyFeatures
                 select f).ToList());
     }
 }
 public List <AdvType> GetAdvTypes()
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from at in context.AdvTypes
                 select at).ToList());
     }
 }
        //#region Property Adv Types
        //public List<PropertyType> GetPropertyTypes()
        //{
        //    using (PropertyHubContext context = new PropertyHubContext())
        //    {
        //        return (from t in context.PropertyTypes
        //                select t).ToList();
        //    }
        //}

        //public PropertyType GetPropertyType(int id)
        //{
        //    using (PropertyHubContext context = new PropertyHubContext())
        //    {
        //        return (from pa in context.PropertyTypes
        //                where pa.Id == id
        //                select pa).FirstOrDefault();
        //    }
        //}

        //public PropertyType AddPropertyType(PropertyType type)
        //{
        //    using (PropertyHubContext context = new PropertyHubContext())
        //    {
        //        context.Add(type);
        //        context.SaveChanges();
        //        return type;
        //    }
        //}

        //public PropertyType UpdatePropertyType(int idToSearch, PropertyType type)
        //{
        //    using (PropertyHubContext context = new PropertyHubContext())
        //    {
        //        PropertyType found = (from t in context.PropertyTypes
        //                              where t.Id == idToSearch
        //                              select t).First();
        //        if (!(string.IsNullOrWhiteSpace(type.Name)))
        //        {
        //            found.Name = type.Name;
        //            context.SaveChanges();
        //        }
        //        return found;
        //    }
        //}


        //public PropertyType DeletePropertyType(int idToSearch)
        //{
        //    using (PropertyHubContext context = new PropertyHubContext())
        //    {
        //        PropertyType found = (from t in context.PropertyTypes
        //                              where t.Id == idToSearch
        //                              select t).First();
        //        context.Remove(found);
        //        context.SaveChanges();
        //        return found;
        //    }
        //}



        //#endregion

        #region Area Units
        public List <AreaUnit> GetAreaUnits()
        {
            using (PropertyHubContext context = new PropertyHubContext())
            {
                return((from au in context.AreaUnits
                        select au).ToList());
            }
        }
 public void DeleteCountry(Country entity, int Id)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.Remove(entity);
         context.SaveChanges();
     }
 }
 public List <Neighborhood> GetNeighborhoods()
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from c in context.HousingSchemes
                 .Include(c => c.City)
                 select c).ToList());
     }
 }
 public PropertyType AddPropertyTypr(PropertyType entity)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.PropertyTypes.Add(entity);
         context.SaveChanges();
     }
     return(entity);
 }
Beispiel #20
0
 public List <AdvType> GetAdvsTypes()
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         List <AdvType> advTypes = (from t in context.AdvTypes
                                    select t).ToList();
         return(advTypes);
     }
 }
Beispiel #21
0
 public List <PropertyAreaUnit> GetPropertyAreaUnits()
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         List <PropertyAreaUnit> result = (from u in context.PropertyAreaUnits
                                           select u).ToList();
         return(result);
     }
 }
 public PropertyType DeletePropertyTypr(PropertyType entity)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.PropertyTypes.Remove(entity);
         context.SaveChanges();
     }
     return(entity);
 }
Beispiel #23
0
 public User DeleteUser(User entity)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.Users.Remove(entity);
         context.SaveChanges();
     }
     return(entity);
 }
Beispiel #24
0
 public void RejectAdv(PropertyAdv entity)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.Entry(entity.Status).State = EntityState.Unchanged;
         context.Update(entity);
         context.SaveChanges();
     }
 }
Beispiel #25
0
 public void AddCity(City entity)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.Entry(entity.Province).State = EntityState.Unchanged;
         context.Add(entity);
         context.SaveChanges();
     }
 }
Beispiel #26
0
 public List <User> GetUsers()
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from u in context.Users
                 .Include("Role")
                 .Include("Address.City.Province.Country")
                 select u).ToList());
     }
 }
 public Neighborhood GetNeighborhood(int id)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         return((from c in context.HousingSchemes
                 .Include(c => c.City)
                 where c.Id == id
                 select c).FirstOrDefault());
     }
 }
Beispiel #28
0
 public Neighborhood DeleteNeighborhood(int id)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         Neighborhood found = context.Find <Neighborhood>(id);
         context.Remove(found);
         context.SaveChanges();
         return(found);
     }
 }
Beispiel #29
0
 public Neighborhood AddNeighborhood(Neighborhood entity)
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         context.Entry(entity.City).State = EntityState.Unchanged;
         context.Add(entity);
         context.SaveChanges();
         return(entity);
     }
 }
Beispiel #30
0
 public List <Neighborhood> GetNeighborhoods()
 {
     using (PropertyHubContext context = new PropertyHubContext())
     {
         List <Neighborhood> areasList = (from a in context.Neighborhoods
                                          .Include(a => a.City.Province.Country)
                                          select a).ToList();
         return(areasList);
     }
 }