public string UpdInfoFromMinfo(InfoParams param) { string jsonstr = ""; try { int count_id = Convert.ToInt32(param.countid); var model = entity.hp_mcount.First(o => o.infoid == count_id); var infoModel = entity.hp_minfo.First(o => o.id == count_id); #region 非空即修改 if (param.icon != null && param.icon != "") model.icon = param.icon; if (param.nickname != null && param.nickname != "") model.nickname = param.nickname; if (param.sex != null && param.sex != "") infoModel.sex = Convert.ToBoolean(param.sex); if (param.persign != null && param.persign != "") model.persign = param.persign; #endregion entity.SaveChanges(); jsonstr = ReturnJson.toJson("100", "修改成功", -1); } catch (Exception e) { jsonstr = ReturnJson.toJson("101", "修改失败", -1); } return jsonstr; }
private InfoParams GetParams() { InfoParams param = new InfoParams(); param.countid = Request.Form["countid"]; param.icon = Request.Form["icon"]; param.nickname = Request.Form["nickname"]; param.sex = Request.Form["sex"]; param.persign = Request.Form["persign"]; return param; }