public ActionResult LogOn(AccountViewModel model, string ReturnUrl) { if (!String.IsNullOrEmpty(model.sifre) && model.sifre.Length > 0) { var user = baglanti() .Select<Kullanici>() .SingleOrDefault(x => x.kullanici_adi == model.kullanici_adi && x.sifre == model.sifre); if (user != null) { FormsAuthentication.SetAuthCookie(user.ToString(), false); Session["User"] = user; return RedirectToAction("Index", "Home"); } else if (user == null) { return RedirectToAction("LogOn", "Account"); } } else { ModelState.AddModelError("", "Kullanıcı Hatası."); } model.Message = Utils.Utils.GetModelStateErrors(ModelState, "<br>"); return View(model); }
public ActionResult LogOn() { var logOnModel = new AccountViewModel(); return View(logOnModel); }