Esempio n. 1
0
        public BusinessLayerResult <Test_Master> LoginTestMaster(TestMasterLoginViewModel data)
        {
            Test_Master tm = Find(x => x.mail == data.email && x.password != data.password);

            if (tm != null)
            {
                tm.notifications.Add(new Notification {
                    notification = "IP: " + GetIp() + " - HATALI GİRİŞ YAPILMIŞTIR", link = "#"
                });
            }
            Test_Master test_master = Find(x => x.mail == data.email && x.password == data.password);
            BusinessLayerResult <Test_Master> res = new BusinessLayerResult <Test_Master>();

            res.Result = test_master;
            if (test_master != null)
            {
                if (!test_master.IsActive)
                {
                    res.AddError(ErrorMessageCode.UserIsNotActive, "Hesap aktifleştirilmemiştir.");
                    res.AddError(ErrorMessageCode.CheckYourEmail, "Lütfen E-Posta adresinizi kontrol ediniz.");
                }
            }
            else
            {
                res.AddError(ErrorMessageCode.EMailorPassWrong, "Kullanıcı adı ya da parola uyuşmuyor.");
            }
            return(res);
        }
Esempio n. 2
0
        public ActionResult TestMasterLogin(TestMasterLoginViewModel model)
        {
            if (ModelState.IsValid)
            {
                TestMasterManager tm = new TestMasterManager();
                BusinessLayerResult <Test_Master> res = tm.LoginTestMaster(model);
                if (res.Errors.Count > 0)
                {
                    if (res.Errors.Find(x => x.Code == ErrorMessageCode.UserIsNotActive) != null)
                    {
                        ViewBag.SetLink = "http://localhost:53605/Home/TestMasterActivate/" + res.Result.ActivateGuid.ToString();
                    }

                    res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));
                    return(View(model));
                }
                Session["login"] = res.Result;                //Session'a kullanıcı bilgi saklama..
                return(RedirectToAction("Index", "Job_Adv")); //Yönlendirme
            }

            return(View());
        }