public ActionResult Edit(int id) { wms_cangkuqy tempData = ob_wms_cangkuqyservice.GetEntityById(wms_cangkuqy => wms_cangkuqy.ID == id && wms_cangkuqy.IsDelete == false); ViewBag.wms_cangkuqy = tempData; if (tempData == null) { return(View()); } else { wms_cangkuqyViewModel wms_cangkuqyviewmodel = new wms_cangkuqyViewModel(); wms_cangkuqyviewmodel.ID = tempData.ID; wms_cangkuqyviewmodel.CangkuID = tempData.CangkuID; wms_cangkuqyviewmodel.Mingcheng = tempData.Mingcheng; wms_cangkuqyviewmodel.Daima = tempData.Daima; wms_cangkuqyviewmodel.Col1 = tempData.Col1; wms_cangkuqyviewmodel.Col2 = tempData.Col2; wms_cangkuqyviewmodel.Col3 = tempData.Col3; wms_cangkuqyviewmodel.MakeDate = tempData.MakeDate; wms_cangkuqyviewmodel.MakeMan = tempData.MakeMan; wms_cangkuqyviewmodel.Leixing = tempData.Leixing; wms_cangkuqyviewmodel.GongnengLX = tempData.GongnengLX; return(View(wms_cangkuqyviewmodel)); } }
public ActionResult Update() { string id = Request["id"] ?? ""; string cangkuid = Request["cangkuid"] ?? ""; string mingcheng = Request["mingcheng"] ?? ""; string daima = Request["daima"] ?? ""; string col1 = Request["col1"] ?? ""; string col2 = Request["col2"] ?? ""; string col3 = Request["col3"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; string leixing = Request["leixing"] ?? ""; string gongnenglx = Request["gongnenglx"] ?? ""; int uid = int.Parse(id); try { wms_cangkuqy p = ob_wms_cangkuqyservice.GetEntityById(wms_cangkuqy => wms_cangkuqy.ID == uid); p.CangkuID = cangkuid == "" ? 0 : int.Parse(cangkuid); p.Mingcheng = mingcheng.Trim(); p.Daima = daima.Trim(); p.Col1 = col1.Trim(); p.Col2 = col2.Trim(); p.Col3 = col3.Trim(); p.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); p.MakeMan = makeman == "" ? 0 : int.Parse(makeman); p.Leixing = leixing == "" ? 0 : int.Parse(leixing); p.GongnengLX = gongnenglx == "" ? 0 : int.Parse(gongnenglx); ob_wms_cangkuqyservice.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 cangkuid = Request["cangkuid"] ?? ""; string mingcheng = Request["mingcheng"] ?? ""; string daima = Request["daima"] ?? ""; string col1 = Request["col1"] ?? ""; string col2 = Request["col2"] ?? ""; string col3 = Request["col3"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; string leixing = Request["leixing"] ?? ""; string gongnenglx = Request["gongnenglx"] ?? ""; try { wms_cangkuqy ob_wms_cangkuqy = new wms_cangkuqy(); ob_wms_cangkuqy.CangkuID = cangkuid == "" ? 0 : int.Parse(cangkuid); ob_wms_cangkuqy.Mingcheng = mingcheng.Trim(); ob_wms_cangkuqy.Daima = daima.Trim(); ob_wms_cangkuqy.Col1 = col1.Trim(); ob_wms_cangkuqy.Col2 = col2.Trim(); ob_wms_cangkuqy.Col3 = col3.Trim(); ob_wms_cangkuqy.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); ob_wms_cangkuqy.MakeMan = makeman == "" ? 0 : int.Parse(makeman); ob_wms_cangkuqy.Leixing = leixing == "" ? 0 : int.Parse(leixing); ob_wms_cangkuqy.GongnengLX = gongnenglx == "" ? 0 : int.Parse(gongnenglx); ob_wms_cangkuqy = ob_wms_cangkuqyservice.AddEntity(ob_wms_cangkuqy); ViewBag.wms_cangkuqy = ob_wms_cangkuqy; } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("Index")); }