// 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()));
 }
Exemple #2
0
 // 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()));
 }
Exemple #3
0
        // 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());
        }
Exemple #4
0
        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());
        }