public bool clrReq() { using (var context = new toletBDdbEntities1()) { context.Governs.ToList().ForEach(p => context.Governs.Remove(p)); context.SaveChanges(); return(true); } }
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(); } }
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); } }
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; }
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); }
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); } } }
public bool chkUser(String id) { using (var context = new toletBDdbEntities1()) { if (context.Users.Any(x => x.users_id == id)) { return(true); } else { return(false); } } }
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(); } }
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(); } }
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; } } }
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); } }
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); } }
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); } }
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); } }
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; } }
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(); } }
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; } }
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; } }
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(); } }
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); } }
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); } }
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); } }