public ActionResult Index(AdministartorModel obj)
        {
            var data = il.GetAllRoles();

            obj.roles = il.GetSelectListItems(data);

            if (ModelState.IsValid)
            {
                if (il.isValid(obj))
                {
                    if (obj.role.Equals("admin"))
                    {
                        FormsAuthentication.SetAuthCookie(obj.username, false);
                        SessionPersister.username = obj.username;

                        return(RedirectToAction("DashboardAdmin", "Home"));
                    }
                    else if (obj.role.Equals("admin whitelist"))
                    {
                        FormsAuthentication.SetAuthCookie(obj.username, false);
                        SessionPersister.username = obj.username;

                        return(RedirectToAction("DashboardAdminWhitelist", "Home"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Login data is incorrect!");
                }
            }
            return(View("Index", obj));
        }
        public bool isValid(AdministartorModel obj)
        {
            query = "ProcLogin";
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@user", obj.username),
                new SqlParameter("@pass", obj.password),
                new SqlParameter("@role", obj.role)
            };
            tb = "administrator";
            dt = new DataTable();

            bool condition = config.eksekusiQuery(query, param, false);

            if (condition)
            {
                config.viewTable(tb).Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    stt = true;
                }
                else
                {
                    stt = false;
                }
            }
            return(stt);
        }
        public ActionResult Index()
        {
            var data  = il.GetAllRoles();
            var model = new AdministartorModel();

            model.roles = il.GetSelectListItems(data);

            return(View(model));
        }