public ActionResult Update() { string id = Request["id"] ?? ""; string chid = Request["chid"] ?? ""; string zhiliangzt = Request["zhiliangzt"] ?? ""; string xiugaiyy = Request["xiugaiyy"] ?? ""; string col1 = Request["col1"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; int uid = int.Parse(id); try { quan_zhiliangwh p = ob_quan_zhiliangwhservice.GetEntityById(quan_zhiliangwh => quan_zhiliangwh.ID == uid); p.CHID = chid == "" ? 0 : int.Parse(chid); p.ZhiliangZT = zhiliangzt == "" ? false : Boolean.Parse(zhiliangzt); p.XiugaiYY = xiugaiyy.Trim(); p.Col1 = col1.Trim(); p.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); p.MakeMan = makeman == "" ? 0 : int.Parse(makeman); ob_quan_zhiliangwhservice.UpdateEntity(p); ViewBag.saveok = ViewAddTag.ModifyOk; } catch (Exception ex) { Console.WriteLine(ex.Message); ViewBag.saveok = ViewAddTag.ModifyNo; } return RedirectToAction("Edit", new { id = uid }); }
public ActionResult Save() { string id = Request["id"] ?? ""; string chid = Request["chid"] ?? ""; string zhiliangzt = Request["zhiliangzt"] ?? ""; string xiugaiyy = Request["xiugaiyy"] ?? ""; string col1 = Request["col1"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; try { quan_zhiliangwh ob_quan_zhiliangwh = new quan_zhiliangwh(); ob_quan_zhiliangwh.CHID = chid == "" ? 0 : int.Parse(chid); ob_quan_zhiliangwh.ZhiliangZT = zhiliangzt == "" ? false : Boolean.Parse(zhiliangzt); ob_quan_zhiliangwh.XiugaiYY = xiugaiyy.Trim(); ob_quan_zhiliangwh.Col1 = col1.Trim(); ob_quan_zhiliangwh.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); ob_quan_zhiliangwh.MakeMan = makeman == "" ? 0 : int.Parse(makeman); ob_quan_zhiliangwh = ob_quan_zhiliangwhservice.AddEntity(ob_quan_zhiliangwh); ViewBag.quan_zhiliangwh = ob_quan_zhiliangwh; } catch (Exception ex) { Console.WriteLine(ex.Message); } return RedirectToAction("Index"); }
public ActionResult Edit(int id) { quan_zhiliangwh tempData = ob_quan_zhiliangwhservice.GetEntityById(quan_zhiliangwh => quan_zhiliangwh.ID == id && quan_zhiliangwh.IsDelete == false); ViewBag.quan_zhiliangwh = tempData; if (tempData == null) return View(); else { quan_zhiliangwhViewModel quan_zhiliangwhviewmodel = new quan_zhiliangwhViewModel(); quan_zhiliangwhviewmodel.ID = tempData.ID; quan_zhiliangwhviewmodel.CHID = tempData.CHID; quan_zhiliangwhviewmodel.ZhiliangZT = tempData.ZhiliangZT; quan_zhiliangwhviewmodel.XiugaiYY = tempData.XiugaiYY; quan_zhiliangwhviewmodel.Col1 = tempData.Col1; quan_zhiliangwhviewmodel.MakeDate = tempData.MakeDate; quan_zhiliangwhviewmodel.MakeMan = tempData.MakeMan; return View(quan_zhiliangwhviewmodel); } }