// GET: Parents public ActionResult Index() { if ((Object)Session["as_role"] == null) { if ((Object)Session["Login"] == null) { return(RedirectToAction("Login", "Users")); } else { return(RedirectToAction("NoRole", "Users")); } } return(View(modelClass.Read())); }
// GET: Parents public ActionResult Index() { //if ((Object)Session["Login"] == null) //{ // return RedirectToAction("Login", "Users"); //} if ((Object)Session["Login"] == null) { ViewBag.isLogin = false; } else { ViewBag.isLogin = true; } return(View(modelClass.Read())); }
// GET: Children/Create public ActionResult Create() { if ((Object)Session["as_role"] == null) { if ((Object)Session["Login"] == null) { return(RedirectToAction("Login", "Users")); } else { return(RedirectToAction("NoRole", "Users")); } } parentClass p = new parentClass(); ViewData["list_parent"] = new SelectList(p.Read(), "parent_id", "parent_name"); return(View()); }
public ActionResult Create([Bind(Include = "child_id,child_name, f_parent_id")] ChildrenClass child) { ViewBag.isExist = "NO"; if (modelClass.isExist(child)) { //when isExist child_name ViewBag.isExist = "Same child Name is exist already."; } else { if (ModelState.IsValid) { modelClass.Add(child); return(RedirectToAction("Index")); } } parentClass p = new parentClass(); ViewData["list_parent"] = new SelectList(p.Read(), "parent_id", "parent_name"); return(View()); }