public ActionResult Update() { string id = Request["id"] ?? ""; string bianhao = Request["bianhao"] ?? ""; string mingcheng = Request["mingcheng"] ?? ""; string miaoshu = Request["miaoshu"] ?? ""; string col1 = Request["col1"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; int uid = int.Parse(id); try { base_quyu p = ob_base_quyuservice.GetEntityById(base_quyu => base_quyu.ID == uid); p.Bianhao = bianhao.Trim(); p.Mingcheng = mingcheng.Trim(); p.Miaoshu = miaoshu.Trim(); p.Col1 = col1.Trim(); p.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); p.MakeMan = makeman == "" ? 0 : int.Parse(makeman); ob_base_quyuservice.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["id"] ?? ""; string bianhao = Request["bianhao"] ?? ""; string mingcheng = Request["mingcheng"] ?? ""; string miaoshu = Request["miaoshu"] ?? ""; string col1 = Request["col1"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; try { base_quyu ob_base_quyu = new base_quyu(); ob_base_quyu.Bianhao = bianhao.Trim(); ob_base_quyu.Mingcheng = mingcheng.Trim(); ob_base_quyu.Miaoshu = miaoshu.Trim(); ob_base_quyu.Col1 = col1.Trim(); ob_base_quyu.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); ob_base_quyu.MakeMan = makeman == "" ? 0 : int.Parse(makeman); ob_base_quyu = ob_base_quyuservice.AddEntity(ob_base_quyu); ViewBag.base_quyu = ob_base_quyu; } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { base_quyu tempData = ob_base_quyuservice.GetEntityById(base_quyu => base_quyu.ID == id && base_quyu.IsDelete == false); ViewBag.base_quyu = tempData; if (tempData == null) { return(View()); } else { base_quyuViewModel base_quyuviewmodel = new base_quyuViewModel(); base_quyuviewmodel.ID = tempData.ID; base_quyuviewmodel.Bianhao = tempData.Bianhao; base_quyuviewmodel.Mingcheng = tempData.Mingcheng; base_quyuviewmodel.Miaoshu = tempData.Miaoshu; base_quyuviewmodel.Col1 = tempData.Col1; base_quyuviewmodel.MakeDate = tempData.MakeDate; base_quyuviewmodel.MakeMan = tempData.MakeMan; return(View(base_quyuviewmodel)); } }