public ActionResult Index(SystemUsr systemUser) { var UserDb = db.SystemUsrs.FirstOrDefault(x => x.Name == systemUser.Name && x.Password == systemUser.Password); if (UserDb != null) { FormsAuthentication.SetAuthCookie(UserDb.Name, false); return(RedirectToAction("Index", "Dashboard")); } else { ViewBag.Message = "Username or password is not true"; return(View()); } }
public ActionResult Register(SystemUsr systemUser) { db.SystemUsrs.Add(systemUser); db.SaveChanges(); return(RedirectToAction("Index")); }