public ActionResult Register(RegisterViewModel reg_user)
        {
            bool deneme = Request.Form["IsInvestor"] != null && (Request.Form["IsInvestor"].ToString()) == "on";

            reg_user.IsInvestor = deneme;
            if (ModelState.IsValid)
            {
                BusinessLayerResult <User> user = new BusinessLayerResult <User>();
                LoginRegisterManager       lgm  = new LoginRegisterManager();
                user = lgm.Register(reg_user);
                if (user.Errors.Count > 0)
                {
                    user.Errors.ForEach(x => ModelState.AddModelError("", x.Description));
                    ViewBag.Result = user.Errors[0].ToString();
                    ViewBag.BG     = "red";
                }
                else
                {
                    ViewBag.Result = "Kayıt başarıyla eklendi...";
                    ViewBag.BG     = "green";
                }
            }
            else
            {
                ViewBag.BG     = "red";
                ViewBag.Result = "Kayıt sırasında hata oluştu.";
            }
            return(View());
        }
        public ActionResult LogIn(string password, string username)
        {
            LoginRegisterManager       lgm    = new LoginRegisterManager();
            BusinessLayerResult <User> result = new BusinessLayerResult <User>();

            result.Result = lgm.Find(x => x.UserName == username && x.Password == password);
            if (ModelState.IsValid)
            {
                LoginViewModel log_in = new LoginViewModel()
                {
                    Password = password, UserName = username
                };
                result = lgm.Login(log_in);
                if (result.Errors.Count > 0)
                {
                    result.Errors.ForEach(x => ModelState.AddModelError("", x.Description));
                }
                else
                {
                    Session["user"] = result.Result;
                }
            }
            if (Session["user"] == null)
            {
                ViewBag.Error     = "Login";
                TempData["Error"] = null;
                return(View("ErrorPage"));// Content("Hatalı kullanıcı adı ya da şifre.!");
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }