public int UpdateShopInfo(T_ShopInfo model) { using (IDbConnection conn = DapperAdapter.MySQLOpenConnection(ConfigurationHelper.MySQLConnectionStr)) { string updateSql = "UPDATE T_ShopInfo SET logo=@logo,shopName=@shopName,shopPhone=@shopPhone,shopAddress=@shopAddress,ShopCo_ordinate=@ShopCo_ordinate,shopInfo=@shopInfo where id=@id;"; return(conn.Execute(updateSql, model)); } }
public int SaveShopInfo(T_ShopInfo model) { using (IDbConnection conn = DapperAdapter.MySQLOpenConnection(ConfigurationHelper.MySQLConnectionStr)) { string addSQL = @"INSERT INTO T_ShopInfo (logo,shopName,shopPhone,shopAddress,ShopCo_ordinate,shopInfo,createTime)VALUES (@logo,@shopName,@shopPhone,@shopAddress,@ShopCo_ordinate,@shopInfo,@createTime)"; return(conn.Execute(addSQL, model)); } }
public ActionResult Index() { T_ShopInfo model = this._shop.GetShopinfo(1); if (model == null) { model = new T_ShopInfo(); } else { if (!string.IsNullOrWhiteSpace(model.logo)) { model.logo = new WebSecurityHelper.CommonController().GetURL("/Content/img/") + model.logo; } } return(View(model)); }
public ActionResult SaveShopInfo(T_ShopInfo shop) { int result = 0; if (shop.id < 1) { shop.createTime = shop.updateTime = DateTime.Now; if (!string.IsNullOrWhiteSpace(shop.logo)) { string path = Server.MapPath("~/Content/img/"); path = Common.ImgBase64.Base64StringToImage(shop.logo, path); shop.logo = path; } result = this._shop.SaveShopInfo(shop); } else { shop.updateTime = DateTime.Now; T_ShopInfo oldmodel = this._shop.GetShopinfo(shop.id); if (oldmodel.logo != shop.logo) { if (shop.logo.Contains(oldmodel.logo)) { shop.logo = oldmodel.logo; } else { string path = Server.MapPath("~/Content/img/"); string imgPath = Common.ImgBase64.Base64StringToImage(shop.logo, path); shop.logo = imgPath; } } result = this._shop.UpdateShopInfo(shop); } return(Response(result)); }
/// <summary> /// 俱乐部成员信息 /// </summary> /// <param name="userid"></param> /// <param name="user"></param> /// <returns></returns> public _Response GetShopInfo(string json) { //JObject obj = JObject.Parse(json); //int userid = Convert.ToInt32(obj["userid"]); T_ShopInfo entity = this._shop.GetShopinfo(1); if (entity != null && !string.IsNullOrWhiteSpace(entity.logo)) { if (!string.IsNullOrWhiteSpace(entity.logo)) { entity.logo = Config.GetValue("BackGroundServer") + entity.logo; } } _Response result = new _Response(true); result.body = entity; return(result); }