/// <summary> /// 编辑保险类型_show /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Edit(int id) { Response _resp = new Response(); BxType _bxt = _bxtm.Find(id); if (_bxt == null) { _resp.Status = 0; _resp.Message = "未找到相关的保险类型记录"; return(Json(_resp)); } return(View(_bxt)); }
public ActionResult Add(BxType bxt) { Response _resp = new Response(); if (!ModelState.IsValid) { _resp.Status = 0; _resp.Message = General.GetModelErrorString(ModelState); return(Json(_resp)); } BxType _bxt = new BxType(); _bxt.BxTypeName = bxt.BxTypeName; _bxt.BxRemark = bxt.BxRemark; _bxt.CreatDateTime = DateTime.Now; _resp = _bxtm.Add(_bxt); if (_resp.Status == 1) { _resp.Message = "恭喜!添加保险行业成功!"; } return(Json(_resp)); }
public ActionResult Edit(int id, FormCollection fm) { Response _resp = new Response(); BxType _bxt = _bxtm.Find(id); if (_bxt == null) { _resp.Status = 0; _resp.Message = _resp.Message = "未找到相关的保险类型记录"; return(Json(_resp)); } if (_bxtm.ExitsName(fm["BxTypeName"])) { _resp.Status = 0; _resp.Message = _resp.Message = "错误!存在保险类型重名的记录"; return(Json(_resp)); } TryUpdateModel(_bxt, new string[] { "BxTypeName", "BxRemark" }); if (!ModelState.IsValid) { _resp.Status = 0; _resp.Message = General.GetModelErrorString(ModelState); return(Json(_resp)); } _resp = _bxtm.Update(_bxt); if (_resp.Status == 1) { _resp.Message = "恭喜!修改保险类型数据成功"; } return(Json(_resp)); }