public ActionResult Edit(int id) { base_chanpinxian tempData = ob_base_chanpinxianservice.GetEntityById(base_chanpinxian => base_chanpinxian.ID == id && base_chanpinxian.IsDelete == false); ViewBag.base_chanpinxian = tempData; return(View()); }
public ActionResult Update() { string id = Request["ob_base_chanpinxian_id"] ?? ""; string huozhuxuhao = Request["ob_base_chanpinxian_huozhuxuhao"] ?? ""; string mingcheng = Request["ob_base_chanpinxian_mingcheng"] ?? ""; string miaoshu = Request["ob_base_chanpinxian_miaoshu"] ?? ""; string col1 = Request["ob_base_chanpinxian_col1"] ?? ""; string col2 = Request["ob_base_chanpinxian_col2"] ?? ""; string col3 = Request["ob_base_chanpinxian_col3"] ?? ""; string makedate = Request["ob_base_chanpinxian_makedate"] ?? ""; string makeman = Request["ob_base_chanpinxian_makeman"] ?? ""; int uid = int.Parse(id); try { base_chanpinxian p = ob_base_chanpinxianservice.GetEntityById(base_chanpinxian => base_chanpinxian.ID == uid); p.Huozhuxuhao = huozhuxuhao == "" ? 0 : int.Parse(huozhuxuhao); p.Mingcheng = mingcheng.Trim(); p.Miaoshu = miaoshu.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); ob_base_chanpinxianservice.UpdateEntity(p); ViewBag.saveok = ViewAddTag.ModifyOk; } catch (Exception ex) { Console.WriteLine(ex.Message); ViewBag.saveok = ViewAddTag.ModifyNo; } return(RedirectToAction("Index")); }
public ActionResult Save() { string id = Request["ob_base_chanpinxian_id"] ?? ""; string huozhuxuhao = Request["ob_base_chanpinxian_huozhuxuhao"] ?? ""; string mingcheng = Request["ob_base_chanpinxian_mingcheng"] ?? ""; string miaoshu = Request["ob_base_chanpinxian_miaoshu"] ?? ""; string col1 = Request["ob_base_chanpinxian_col1"] ?? ""; string col2 = Request["ob_base_chanpinxian_col2"] ?? ""; string col3 = Request["ob_base_chanpinxian_col3"] ?? ""; string makedate = Request["ob_base_chanpinxian_makedate"] ?? ""; string makeman = Request["ob_base_chanpinxian_makeman"] ?? ""; try { base_chanpinxian ob_base_chanpinxian = new base_chanpinxian(); ob_base_chanpinxian.Huozhuxuhao = huozhuxuhao == "" ? 0 : int.Parse(huozhuxuhao); ob_base_chanpinxian.Mingcheng = mingcheng.Trim(); ob_base_chanpinxian.Miaoshu = miaoshu.Trim(); ob_base_chanpinxian.Col1 = col1.Trim(); ob_base_chanpinxian.Col2 = col2.Trim(); ob_base_chanpinxian.Col3 = col3.Trim(); ob_base_chanpinxian.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); ob_base_chanpinxian.MakeMan = makeman == "" ? 0 : int.Parse(makeman); ob_base_chanpinxian = ob_base_chanpinxianservice.AddEntity(ob_base_chanpinxian); ViewBag.base_chanpinxian = ob_base_chanpinxian; } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("Index")); }