public ActionResult DavetEt(int DavetEdilenId, int oyunId) { lobbys lobby = new lobbys(); lobby.userAl = db.user.Find(DavetEdilenId); lobby.userGon = db.user.Find(int.Parse(Session["id"].ToString())); lobby.status = 0; lobby.date = DateTime.Now; lobby.game = db.game.Find(oyunId); db.lobby.Add(lobby); db.SaveChanges(); if (oyunId == 1) { return(RedirectToAction("SearchLol")); } else if (oyunId == 2) { return(RedirectToAction("Search")); } else { return(RedirectToAction("Index")); } }
public ActionResult Login(FormCollection fc) { var a = fc["usernameL"].ToString(); var b = fc["passL"].ToString(); var usr = db.user.Where(u => u.username == a && u.password == b).FirstOrDefault(); if (usr != null) { Session["id"] = usr.id; Session["Ad"] = usr.username; Session["yetki"] = usr.role.id; Session["search"] = usr.search == true ? "1" : "0"; usr.online = true; db.Entry(usr).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Find")); } else { ModelState.AddModelError("", "my db Kullanıcı adı veya şifre hatalı."); } return(View()); }