public ActionResult Create(T_XM_Transaction t_xm_transaction, FormCollection fc) { if (ModelState.IsValid) { int itype = 0; if (fc["itype"]!=null||fc["itype"]!="") itype = Convert.ToInt32(fc["itype"]); t_xm_transaction.TranTime = Convert.ToDateTime(fc["trantime"]); t_xm_transaction.TranContent = fc["trancontent"]; t_xm_transaction.IsValid = true; t_xm_transaction.OP = 0; t_xm_transaction.CreateTime = DateTime.Now; t_xm_transaction.UpdateTime = DateTime.Now; db.T_XM_Transaction.Add(t_xm_transaction); //添加到案例库 BusinessService.TransformatFromXM(t_xm_transaction.ItemID, t_xm_transaction.TranTitle, itype, t_xm_transaction.TranContent); int result = db.SaveChanges(); if (result > 0) return ReturnJson(true, "操作成功", "", "", true, ""); else return ReturnJson(false, "操作失败", "", "", false, ""); } return Json(new { }); }
// // GET: /XM_JY/Create public ActionResult Create(int id = 0,int itype=0) { var t_xm_tran = new T_XM_Transaction(); t_xm_tran.ItemID = id; t_xm_tran.TranTitle = GetItemName(id,itype); ViewBag.itype = itype; return View(t_xm_tran); }
public ActionResult Edit(T_XM_Transaction t_xm_transaction, FormCollection fc) { if (ModelState.IsValid) { db.Entry(t_xm_transaction).State = EntityState.Modified; t_xm_transaction.TranTime = Convert.ToDateTime(fc["trantime"]); t_xm_transaction.TranContent = fc["trancontent"]; t_xm_transaction.UpdateTime = DateTime.Now; int result = db.SaveChanges(); if (result > 0) return ReturnJson(true, "操作成功", "", "", true, ""); else return ReturnJson(false, "操作失败", "", "", false, ""); } return Json(new { }); }