public IEnumerable <PrincipalModel> GetPrincipal() { string sql = "SELECT Principal.Id,PrincipalName,PrincipalPhone,CommodityName,Enter,CommodityId,PrImage,Email,QQ,WeChat,CommodityPhone,CommoditySite,CommodityState,CommodityArgot FROM Principal INNER JOIN Commodity ON Principal.CommodityId = Commodity.Id"; return(DapperHelper <PrincipalModel> .Query(sql, null)); }
/// <summary> /// 获取经纪人信息 /// </summary> /// <returns></returns> public IEnumerable <PrincipalModel> GetPrincipalById(int id) { string sql = $"select * from Principal p join Commodity c on c.Id =p.CommodityId where p.Id={id}"; return(DapperHelper <PrincipalModel> .Query(sql, null)); }
//添加客户信息 public int AddClientInfo(ClientInfoModel cm) { return(DapperHelper <ClientInfoModel> .Execute($"insert into ClientInfo values('{cm.ClientName}','{cm.ClientPhone}',{cm.ClientSex})", null)); }
public IEnumerable <HouseCollectModel> GetHouseCollect() { string sql = $"select * from HouseCollect where HouseType=7 and HouseModel=1"; return(DapperHelper <HouseCollectModel> .Query(sql, null)); }
//获取商家信息 public List <CommodityModel> CommodityShow() { string str = "select *from Commodity"; return(DapperHelper <CommodityModel> .Query(str, null)); }
//添加商家信息 public int AddCommodity(CommodityModel cdm) { return(DapperHelper <CommodityModel> .Execute($"insert into Commodity values('{cdm.CommodityName}','{cdm.CommodityPhone}','{cdm.CommoditySite}','{cdm.CommodityArgot}','{cdm.CommodityState}')", null)); }
/// <summary> /// 删除新房源 /// </summary> /// <param name="id"></param> /// <returns></returns> public int DelHouse(int id) { string sql = $"Delete from HouseCollect where Id={id}"; return(DapperHelper <HouseCollectModel> .Execute(sql, null)); }
//根据id查询二维码 public string GetUrl(int id) { string str = "select WeChat from Principal where Id=" + id; return(DapperHelper <string> .ExecuteScalarForT(str, null)); }
/// <summary> /// 获取经纪人信息 /// </summary> /// <returns></returns> public List <PrincipalModel> GetPrincipals() { string sql = "select * from GetPrincipals"; return(DapperHelper <PrincipalModel> .Query(sql, null)); }
/// <summary> /// 显示新房源 /// </summary> /// <returns></returns> public IEnumerable <HouseCollectModel> houseCollects() { string sql = " select * from HouseCollect where HouseModel =1"; return(DapperHelper <HouseCollectModel> .Query(sql, null)); }
/// <summary> /// 添加房源 /// </summary> /// <param name="model"></param> /// <returns></returns> public int AddHouse(HouseCollectModel model) { string sql = $"insert into HouseCollect values('{model.HouseName}','{model.HouseSite}','{model.HouseInfo}',{model.HouseType},{model.HouseGradation},{model.HouseSum},{model.HousePrice},{model.HouseArea},'Wybimages/{model.HouseImage}','{model.HouseIntro}',{model.HouseModel},'{model.HouseTenement}/m²',{model.HouseNumber})"; return(DapperHelper <HouseCollectModel> .Execute(sql, null)); }
/// <summary> /// 显示房屋类型 /// </summary> /// <returns></returns> public IEnumerable <HouseTypeModel> GetHT() { string sql = "select * from HouseType"; return(DapperHelper <HouseTypeModel> .Query(sql, null)); }
//获取客户信息 public IEnumerable <ClientInfoModel> GetClientInfo() { string str = "select *from ClientInfo"; return(DapperHelper <ClientInfoModel> .Query(str, null)); }
//删除经纪人信息 public int DelPrincipal(int id) { return(DapperHelper <PrincipalModel> .Execute("delete from Principal where Id=" + id, null)); }
/// <summary> /// 查询新房 /// </summary> /// <param name="HouseModel"></param> /// <param name="HouseType"></param> /// <returns></returns> public IEnumerable <HouseCollectModel> collectModels(string name) { string sql = $"select * from HouseCollect where HouseName like '%{name}%'"; return(DapperHelper <HouseCollectModel> .Query(sql, null)); }
/// <summary> /// 添加经纪人信息 /// </summary> /// <param name="principalModel"></param> /// <returns></returns> public int AddPrincipal(PrincipalModel principalModel) { return(DapperHelper <PrincipalModel> .Execute($"insert into Principal values('{principalModel.PrincipalName}','{principalModel.PrincipalPhone}',{principalModel.CommodityId},'{principalModel.Enter}','{principalModel.PrImage}','{principalModel.Email}','{principalModel.QQ}','{principalModel.WeChat}')", null)); }
/// <summary> /// 获取房屋状态 /// </summary> /// <returns></returns> public IEnumerable <RoomTypeModel> roomTypes() { string sql = "select * from HouseModel"; return(DapperHelper <RoomTypeModel> .Query(sql, null)); }
/// <summary> /// 获取商家信息 /// </summary> /// <returns></returns> public IEnumerable <CommodityModel> GetCommodities() { return(DapperHelper <CommodityModel> .Query("select * from Commodity", null)); }
/// <summary> /// 添加新房源 /// </summary> /// <param name="house"></param> /// <returns></returns> public int AddNewH(HouseCollectModel house) { string sql = $"insert into HouseCollect values('{house.HouseName}','{house.HouseSite}','{house.HouseInfo}',{house.HouseType},{house.HouseGradation},{house.HouseSum},{house.HousePrice},{house.HouseArea},'Hxlimage/{house.HouseImage}','{house.HouseIntro}',{house.HouseModel},{house.HouseTenement},{house.HouseNumber})"; return(DapperHelper <HouseCollectModel> .Execute(sql, null)); }
//删除商家信息 public int DelCommodity(int id) { return(DapperHelper <CommodityModel> .Execute("delete from Commodity where Id=" + id, null)); }
/// <summary> /// 根据id显示房子具体信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public IEnumerable <HouseCollectModel> houses(int id) { string sql = $"select * from HouseCollect join HouseType on HouseCollect.HouseType=HouseType.Tid where HouseCollect.Id={id}"; return(DapperHelper <HouseCollectModel> .Query(sql, null)); }
////自己创建个类写 这样分开好做 别写我这里面了!!!!!!!!!!!! /// <summary> /// 显示租房列表 /// </summary> /// <returns></returns> public IEnumerable <HouseCollectModel> GetUsedHouse() { string sql = "select * from HouseCollect"; return(DapperHelper <HouseCollectModel> .Query(sql, null)); }
//删除客户信息 public int DelClientInfo(int id) { return(DapperHelper <ClientInfoModel> .Execute("delete from ClientInfo where Id=" + id, null)); }