// GET: login
        public ActionResult Index()
        {
            //var langCookie = HttpContext.Request.Cookies["login_data"];
            loginModel log = new loginModel();
            HttpCookie j = new HttpCookie("login_data");

            if (j.Value == null)
            {  }

            else
            {
                log.cookie_1 = j.Value;
                return RedirectToAction("mainView");
            }
            return View(log);
        }
        public ActionResult mainView()
        {
            var langCookie = HttpContext.Request.Cookies["login_data"];
            loginModel log = new loginModel();
            log.cookie_1 = langCookie.Value;

            /*log.Name = "Learn C#";
            log.type = "Computer";
            log.Price = "$3.99";
            log.Publisher = "Hello";
            string build_json = JsonConvert.SerializeObject(log);
            log.getJSON = build_json;
            loginModel deserializedProduct = JsonConvert.DeserializeObject<loginModel>(build_json);*/

            if (langCookie.Value == "0")
            {
                     // REDIRECT TO LOGIN PAGE
                    return RedirectToAction("/");
                    //Redirect("login/Index");
            }
            return View(log);
        }
        public ActionResult logged(loginModel log)
        {
            string name = Request.Form["email"];
            string pass = Request.Form["pwd"];
            string mode_0 = Request.Form["user"];
            string mode_1 = Request.Form["admn"];

            log.mode_0 = mode_0;
            log.mode_1 = mode_1;

            if (name == "*****@*****.**" && pass == "12345")
            {

                HttpCookie login_cookie = new HttpCookie("login_data", "1");
                HttpContext.Response.Cookies.Add(login_cookie);
                var langCookie = HttpContext.Request.Cookies["login_data"];
                log.hh = "1";

                if (langCookie.Value == "0")
                { }

                if (langCookie.Value == "1" && mode_0=="On")
                {
                    log.hh = "1";
                    return RedirectToAction("mainView");
                }

                if (langCookie.Value == "1" && mode_1 == "On")
                {
                    log.hh = "1";
                    return RedirectToAction("logged");
                }
            }

            else
                log.hh = "0";
            return View(log);
        }