public ActionResult Template_Edit(FormCollection fc, normal_templateContract t, int id, string type, string stype) { if (ModelState.IsValid) { t.Type = type; t.SType = stype; t.IsDefault = 0; t.content = t.content.Replace("'", "\""); t.eid = (Session["user"] as UsersContract).EId; if (id == 0) { //添加 if (TBll.Insert(t) > 0) { // Success ViewData["msg"] = "添加成功!"; ViewData["url"] = Url.Action("Template"); return View("Success"); } else { return View(t); } } else { if (TBll.Update(t) == 1) { ViewData["msg"] = "修改成功!"; ViewData["url"] = Url.Action("Template"); return View("Success"); } else { return View(t); } } } return View(t); }
public int Update(normal_templateContract t) { return Tdao.Update(t.ToPO<normal_template>()); }
/// <summary> /// 添加模版 /// </summary> /// <param name="id"></param> /// <param name="type"></param> /// <param name="stype"></param> /// <returns></returns> public ActionResult Template_Edit(int id, string type, string stype) { normal_templateContract NTC = new normal_templateContract(); if (id == 0) { //添加 NTC.SType = stype; NTC.Type = type; } else { //修改 NTC = TBll.GetTemplateById(id, (Session["user"] as UsersContract).EId); } return View(NTC); }
public int Insert(normal_templateContract t) { return Tdao.Insert(t.ToPO<normal_template>()); }