public ActionResult Login(Login data)
        {
            try 
            { 
                string message = "";

                if(ModelState.IsValid)
                {                 
                    bool allowLogin = userService.LoginAccess(data, ref message);

                    if (allowLogin)
                    {                                  
                        Session["User"] = userService.SetSessionInformation(data.email);
                        if (data.rememberMe)
                        {
                            HttpCookie userCookie = new HttpCookie("libraryUniCookie");
                            userCookie.Domain = "localhost";
                            userCookie.Expires = DateTime.Now.AddDays(15);
                            userCookie.Path = "/";
                            userCookie.Secure = false;
                            userCookie.Value = userService.EncryptSHA256(data.email);
                            Response.Cookies.Add(userCookie);
                        }

                        return Content("<script>location.reload();</script>");
                    }
                    else
                    {
                        throw new Exception();
                    }
                        
                }
                else
                {
                    throw new Exception();
                }
            }
            catch(Exception ex)
            {
                if (ex.InnerException is SqlException)
                {
                    ViewBag.LoginError = "<script>alert('[X] " + ex.InnerException.Message + "');</script>";
                    return PartialView("_Login", data);
                }

                return PartialView("_Login", data);
            }
        }
        public bool LoginAccess(Login data, ref string message)
        {
            ObjectParameter messageParameter = new ObjectParameter("message", typeof(string));
            ObjectParameter allowLogin = new ObjectParameter("allowLogin", typeof(bool));

            try
            {
                context.sp_Login(data.email, data.password, messageParameter, allowLogin);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            message = messageParameter.Value.ToString();

            return Convert.ToBoolean(allowLogin.Value);
        }