public ActionResult Update() { string id = Request["id"] ?? ""; string rolename = Request["rolename"] ?? ""; string funid = Request["funid"] ?? ""; string name = Request["name"] ?? ""; string module = Request["module"] ?? ""; string controller = Request["controller"] ?? ""; string function = Request["function"] ?? ""; string grade = Request["grade"] ?? ""; string ryid = Request["ryid"] ?? ""; int uid = int.Parse(id); try { view_roleperson p = ob_view_rolepersonservice.GetEntityById(view_roleperson => view_roleperson.ID == uid); p.ID = id == "" ? 0 : int.Parse(id); p.rolename = rolename.Trim(); p.funid = funid == "" ? 0 : int.Parse(funid); p.name = name.Trim(); p.module = module.Trim(); p.controller = controller.Trim(); p.function = function.Trim(); p.grade = grade == "" ? 0 : int.Parse(grade); p.ryid = ryid == "" ? 0 : int.Parse(ryid); ob_view_rolepersonservice.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 rolename = Request["rolename"] ?? ""; string funid = Request["funid"] ?? ""; string name = Request["name"] ?? ""; string module = Request["module"] ?? ""; string controller = Request["controller"] ?? ""; string function = Request["function"] ?? ""; string grade = Request["grade"] ?? ""; string ryid = Request["ryid"] ?? ""; try { view_roleperson ob_view_roleperson = new view_roleperson(); ob_view_roleperson.ID = id == "" ? 0 : int.Parse(id); ob_view_roleperson.rolename = rolename.Trim(); ob_view_roleperson.funid = funid == "" ? 0 : int.Parse(funid); ob_view_roleperson.name = name.Trim(); ob_view_roleperson.module = module.Trim(); ob_view_roleperson.controller = controller.Trim(); ob_view_roleperson.function = function.Trim(); ob_view_roleperson.grade = grade == "" ? 0 : int.Parse(grade); ob_view_roleperson.ryid = ryid == "" ? 0 : int.Parse(ryid); ob_view_roleperson = ob_view_rolepersonservice.AddEntity(ob_view_roleperson); ViewBag.view_roleperson = ob_view_roleperson; } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { view_roleperson tempData = ob_view_rolepersonservice.GetEntityById(view_roleperson => view_roleperson.ID == id && view_roleperson.IsDelete == false); ViewBag.view_roleperson = tempData; if (tempData == null) { return(View()); } else { view_rolepersonViewModel view_rolepersonviewmodel = new view_rolepersonViewModel(); view_rolepersonviewmodel.id = tempData.ID; view_rolepersonviewmodel.rolename = tempData.rolename; view_rolepersonviewmodel.funid = tempData.funid; view_rolepersonviewmodel.name = tempData.name; view_rolepersonviewmodel.module = tempData.module; view_rolepersonviewmodel.controller = tempData.controller; view_rolepersonviewmodel.function = tempData.function; view_rolepersonviewmodel.grade = tempData.grade; view_rolepersonviewmodel.ryid = tempData.ryid; return(View(view_rolepersonviewmodel)); } }