예제 #1
0
 public bool clrReq()
 {
     using (var context = new toletBDdbEntities1())
     {
         context.Governs.ToList().ForEach(p => context.Governs.Remove(p));
         context.SaveChanges();
         return(true);
     }
 }
예제 #2
0
 public void addReq(GovernModel um)
 {
     using (var context = new toletBDdbEntities1())
     {
         Govern users = new Govern()
         {
             users_id = um.users_id,
             request  = um.request
         };
         context.Governs.Add(users);
         context.SaveChanges();
     }
 }
예제 #3
0
        public List <GovernModel> getalReq()
        {
            using (var context = new toletBDdbEntities1())
            {
                var res = context.Governs.Select(x => new GovernModel()
                {
                    users_id = x.users_id,
                    request  = x.request
                }).ToList();


                return(res);
            }
        }
예제 #4
0
 public bool delRespond(string id,string s)
 {
     using (var context = new toletBDdbEntities1())
     {
         var ad = context.Interesteds.FirstOrDefault(x => x.ad_id == id && x.users_id==s);
         if (ad != null)
         {
             context.Interesteds.Remove(ad);
             context.SaveChanges();
             return true;
         }
     }
     return false;
 }
예제 #5
0
 public bool delAd(String id)
 {
     using (var context = new toletBDdbEntities1())
     {
         var ad = context.Ads.FirstOrDefault(x => x.ad_id == id);
         if (ad != null)
         {
             context.Ads.Remove(ad);
             context.SaveChanges();
             return(true);
         }
     }
     return(false);
 }
예제 #6
0
 public bool chkloginUser(String id, String pass)
 {
     using (var context = new toletBDdbEntities1())
     {
         if (context.Users.Any(x => x.users_id == id && x.users_pass == pass))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
예제 #7
0
 public bool chkUser(String id)
 {
     using (var context = new toletBDdbEntities1())
     {
         if (context.Users.Any(x => x.users_id == id))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
예제 #8
0
        public void delAd(String id)
        {
            using (var context = new toletBDdbEntities1())
            {
                var ad = context.Ads.FirstOrDefault(x => x.ad_id == id);
                if (ad != null)
                {
                    context.Ads.Remove(ad);
                    context.SaveChanges();
                }

                context.Interesteds.Where(p => p.ad_id == id).ToList().ForEach(p => context.Interesteds.Remove(p));
                context.SaveChanges();
            }
        }
예제 #9
0
 public void addusers(usersModel um)
 {
     using (var context = new toletBDdbEntities1()) {
         User users = new User()
         {
             users_id   = um.users_id,
             users_pass = um.users_pass,
             name       = um.name,
             phone_no   = "",
             addresss   = ""
         };
         context.Users.Add(users);
         context.SaveChanges();
     }
 }
예제 #10
0
        public bool chkRespond(string id,string s)
        {
            using (var context = new toletBDdbEntities1())
            {
                if (context.Interesteds.Any(x => x.ad_id == id && x.users_id==s))
                {
                    return true;
                }
                else
                {

                    return false;
                }

            }
        }
예제 #11
0
        public List <usersModel> getalUsers()
        {
            using (var context = new toletBDdbEntities1()) {
                var res = context.Users.Select(x => new usersModel()
                {
                    users_id   = x.users_id,
                    users_pass = x.users_pass,
                    name       = x.name,
                    phone_no   = x.phone_no,
                    addresss   = x.addresss
                }).ToList();


                return(res);
            }
        }
예제 #12
0
        public List <Adminmodel> Getad()
        {
            using (var con = new toletBDdbEntities1())
            {
                var res = con.Admins.Select(x =>
                                            new Adminmodel()
                {
                    A_id = x.A_id,
                    Name = x.Name,
                    Pass = x.Pass
                }

                                            ).ToList();
                return(res);
            }
        }
예제 #13
0
        public usersModel get1user(String id)
        {
            using (var context = new toletBDdbEntities1())
            {
                var res = context.Users.Where(x => x.users_id == id).Select(x => new usersModel()
                {
                    users_id   = x.users_id,
                    users_pass = x.users_pass,
                    name       = x.name,
                    phone_no   = x.phone_no,
                    addresss   = x.addresss
                }).FirstOrDefault();


                return(res);
            }
        }
예제 #14
0
        public bool updateuser(String id, String name, String phn, String add, String pass)
        {
            using (var context = new toletBDdbEntities1())
            {
                var user = context.Users.FirstOrDefault(x => x.users_id == id);
                if (user != null)
                {
                    user.name       = name;
                    user.phone_no   = phn;
                    user.addresss   = add;
                    user.users_pass = pass;
                }

                context.SaveChanges();
                return(true);
            }
        }
예제 #15
0
        public List<InterestedModel> getalResponder(string id)
        {
            using (var context = new toletBDdbEntities1())
            {
                var res = context.Interesteds.Where(x=>x.ad_id==id ).Select(x => new InterestedModel()
                {
                   users_id=x.users_id,
                   name=x.name,
                   phone=x.phone,
                   occupation=x.occupation,
                   familymembers=x.familymembers,
                   presentAddress=x.presentAddress

                }).ToList();

                return res;
            }
        }
예제 #16
0
 public void addRespond(InterestedModel interestedModel)
 {
     using (var context = new toletBDdbEntities1())
     {
        Interested users = new Interested()
         {
             users_id=interestedModel.users_id,
             name=interestedModel.name,
             ad_id=interestedModel.ad_id,
             phone=interestedModel.phone,
             occupation=interestedModel.occupation,
             familymembers=interestedModel.familymembers,
             presentAddress=interestedModel.presentAddress
         };
         context.Interesteds.Add(users);
         context.SaveChanges();
     }
 }
예제 #17
0
        public bool updateRespond(InterestedModel interestedModel)
        {
            using (var context = new toletBDdbEntities1())
            {
                var ad = context.Interesteds.FirstOrDefault(x => x.ad_id == interestedModel.ad_id);
                if (ad != null)
                {
                    ad.name = interestedModel.name;
                    ad.phone = interestedModel.phone;
                    ad.occupation = interestedModel.occupation;
                    ad.familymembers = interestedModel.familymembers;
                    ad.presentAddress = interestedModel.presentAddress;

                }

                context.SaveChanges();
                return true;
            }
        }
예제 #18
0
        public InterestedModel get1Respond(string id,string s)
        {
            using (var context = new toletBDdbEntities1())
            {
                var res = context.Interesteds.Where(x => x.ad_id == id && x.users_id==s).Select(x => new InterestedModel()
                {
                    ad_id = id,
                    users_id = x.users_id,
                    name = x.name,
                    phone = x.phone,
                    occupation = x.occupation,
                    familymembers = x.familymembers,
                    presentAddress=x.presentAddress

                }).FirstOrDefault();

                return res;
            }
        }
예제 #19
0
        public void postad1(AdModel adModel)
        {
            using (var context = new toletBDdbEntities1())
            {
                Ad add = new Ad()
                {
                    ad_id    = adModel.ad_id,
                    users_id = adModel.users_id,
                    phone    = adModel.phone,
                    rent     = adModel.rent,
                    img1     = adModel.img1,
                    img2     = adModel.img2,
                    img3     = adModel.img3,
                    img4     = adModel.img4,
                    datee    = adModel.datee,


                    availability = adModel.availability,



                    city                = adModel.city,
                    area                = adModel.area,
                    street_name         = adModel.street_name,
                    street_no           = adModel.street_no,
                    additional_addresss = adModel.additional_addresss,



                    number_of_room     = adModel.number_of_room,
                    number_of_kitchen  = adModel.number_of_kitchen,
                    number_of_bathroom = adModel.number_of_bathroom,
                    size_of_flat       = adModel.size_of_flat,
                    additional_info    = adModel.additional_info
                };

                context.Ads.Add(add);


                context.SaveChanges();
            }
        }
예제 #20
0
        public List <AdModel> get4Add()
        {
            using (var context = new toletBDdbEntities1())
            {
                var res = context.Ads.Select(x => new AdModel()
                {
                    ad_id    = x.ad_id,
                    users_id = x.users_id,
                    phone    = x.phone,
                    rent     = x.rent,
                    img1     = x.img1,
                    // img2 = x.img2,
                    //  img3 = x.img3,
                    // img4 = x.img4,
                    datee = x.datee,


                    availability = x.availability,



                    city                = x.city,
                    area                = x.area,
                    street_name         = x.street_name,
                    street_no           = x.street_no,
                    additional_addresss = x.additional_addresss,



                    number_of_room     = x.number_of_room,
                    number_of_kitchen  = x.number_of_kitchen,
                    number_of_bathroom = x.number_of_bathroom,
                    size_of_flat       = x.size_of_flat,
                    additional_info    = x.additional_info
                }).ToList();


                return(res);
            }
        }
예제 #21
0
        public AdModel get1ad(String id)
        {
            using (var context = new toletBDdbEntities1())
            {
                var res = context.Ads.Where(x => x.ad_id == id).Select(x => new AdModel()
                {
                    ad_id    = x.ad_id,
                    users_id = x.users_id,
                    phone    = x.phone,
                    rent     = x.rent,
                    img1     = x.img1,
                    img2     = x.img2,
                    img3     = x.img3,
                    img4     = x.img4,
                    datee    = x.datee,


                    availability = x.availability,



                    city                = x.city,
                    area                = x.area,
                    street_name         = x.street_name,
                    street_no           = x.street_no,
                    additional_addresss = x.additional_addresss,



                    number_of_room     = x.number_of_room,
                    number_of_kitchen  = x.number_of_kitchen,
                    number_of_bathroom = x.number_of_bathroom,
                    size_of_flat       = x.size_of_flat,
                    additional_info    = x.additional_info
                }).FirstOrDefault();


                return(res);
            }
        }
예제 #22
0
        public bool updateAd(AdModel adModel)
        {
            using (var context = new toletBDdbEntities1())
            {
                var ad = context.Ads.FirstOrDefault(x => x.ad_id == adModel.ad_id);
                if (ad != null)
                {
                    ad.phone = adModel.phone;
                    ad.rent  = adModel.rent;

                    // ad.datee = adModel.datee;


                    ad.availability = adModel.availability;



                    ad.city                = adModel.city;
                    ad.area                = adModel.area;
                    ad.street_name         = adModel.street_name;
                    ad.street_no           = adModel.street_no;
                    ad.additional_addresss = adModel.additional_addresss;



                    ad.number_of_room     = adModel.number_of_room;
                    ad.number_of_kitchen  = adModel.number_of_kitchen;
                    ad.number_of_bathroom = adModel.number_of_bathroom;
                    ad.size_of_flat       = adModel.size_of_flat;
                    ad.additional_info    = adModel.additional_info;
                }

                context.SaveChanges();
                return(true);
            }
        }