public ActionResult Edit(int id) { base_gongyingshouquan tempData = ob_base_gongyingshouquanservice.GetEntityById(base_gongyingshouquan => base_gongyingshouquan.ID == id && base_gongyingshouquan.IsDelete == false); ViewBag.base_gongyingshouquan = tempData; return(View()); }
public ActionResult Update() { string id = Request["id"] ?? ""; string gongyingshangid = Request["gongyingshangid"] ?? ""; string shouquanid = Request["shouquanid"] ?? ""; string shouquanmingcheng = Request["shouquanmingcheng"] ?? ""; string shouquanshuyxq = Request["shouquanshuyxq"] ?? ""; string shouquanshutp = Request["shouquanshutp"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; int uid = int.Parse(id); try { base_gongyingshouquan p = ob_base_gongyingshouquanservice.GetEntityById(base_gongyingshouquan => base_gongyingshouquan.ID == uid); p.GongyingshangID = gongyingshangid == "" ? 0 : int.Parse(gongyingshangid); p.ShouquanID = shouquanid == "" ? 0 : int.Parse(shouquanid); p.Shouquanmingcheng = shouquanmingcheng.Trim(); p.ShouquanshuYXQ = shouquanshuyxq == "" ? DateTime.Now : DateTime.Parse(shouquanshuyxq); p.ShouquanshuTP = shouquanshutp.Trim(); p.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); p.MakeMan = makeman == "" ? 0 : int.Parse(makeman); ob_base_gongyingshouquanservice.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 gongyingshangid = Request["gongyingshangid"] ?? ""; string shouquanid = Request["shouquanid"] ?? ""; string shouquanmingcheng = Request["shouquanmingcheng"] ?? ""; string shouquanshuyxq = Request["shouquanshuyxq"] ?? ""; string shouquanshutp = Request["shouquanshutp"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; try { base_gongyingshouquan ob_base_gongyingshouquan = new base_gongyingshouquan(); ob_base_gongyingshouquan.GongyingshangID = gongyingshangid == "" ? 0 : int.Parse(gongyingshangid); ob_base_gongyingshouquan.ShouquanID = shouquanid == "" ? 0 : int.Parse(shouquanid); ob_base_gongyingshouquan.Shouquanmingcheng = shouquanmingcheng.Trim(); ob_base_gongyingshouquan.ShouquanshuYXQ = shouquanshuyxq == "" ? DateTime.Now : DateTime.Parse(shouquanshuyxq); ob_base_gongyingshouquan.ShouquanshuTP = shouquanshutp.Trim(); ob_base_gongyingshouquan.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); ob_base_gongyingshouquan.MakeMan = makeman == "" ? 0 : int.Parse(makeman); ob_base_gongyingshouquan = ob_base_gongyingshouquanservice.AddEntity(ob_base_gongyingshouquan); ViewBag.base_gongyingshouquan = ob_base_gongyingshouquan; } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("Index")); }