public ActionResult Create(User user) { if (ModelState.IsValid) { db.Users.Add(user); db.SaveChanges(); return RedirectToAction("Index"); } return View(user); }
public ActionResult LogIn(User user) { var userExist = (from u in db.Users where u.UserName == user.UserName && u.Password == user.Password select u).Count(); if (userExist > 0) { Session["userName"] = user.UserName; Session["userLogged"] = true; return RedirectToAction("Index", "News"); } else { ViewBag.errorCredenciales = "Datos Erroneos"; } return View(); }