public ActionResult LoginTercuman(LoginViewModelTranslator model) { if (ModelState.IsValid) { BusinessLayerResult <Tercuman> res = tercumanManager.LoginTranslator(model); if (res.Errors.Count > 0) { res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); return(View(model)); } CurrentSessionsTercuman.Set <Tercuman>("login", res.Result); // Session'a kullanıcı bilgi saklama.. return(RedirectToAction("IndexTercuman")); // yönlendirme.. } return(View(model)); }
public BusinessLayerResult <Tercuman> LoginTranslator(LoginViewModelTranslator data) { // Giriş kontrolü // Hesap aktive edilmiş mi? BusinessLayerResult <Tercuman> res = new BusinessLayerResult <Tercuman>(); res.Result = Find(x => x.Email == data.Email && x.Password == data.Password); if (res.Result != null) { if (!res.Result.IsActive) { res.AddError(ErrorMessageCode.UserIsNotActive, "Kullanıcı aktifleştirilmemiştir."); res.AddError(ErrorMessageCode.CheckYourEmail, "Lütfen e-posta adresinizi kontrol ediniz."); } } else { res.AddError(ErrorMessageCode.NameOrPassWrong, "Kullanıcı mail yada şifre uyuşmuyor."); } return(res); }