public ActionResult HtmlHelperExample() { EmployeeModel em = new EmployeeModel(); em.EmpName = "test value"; EmployeeEntities db = new Models.EmployeeEntities(); ViewBag.State = new SelectList(db.States, "Id", "StateName", 2); return(View(em)); }
public ActionResult Login(UserDetail user) { EmployeeEntities db = new Models.EmployeeEntities(); var userinfo = db.UserDetails.Where(x => x.UserName == user.UserName).FirstOrDefault(); if (userinfo != null) { var userpwd = db.UserDetails.Where(x => x.UserName == user.UserName && x.Password == user.Password).FirstOrDefault(); if (userpwd != null) { FormsAuthentication.SetAuthCookie(user.UserName, false); return(RedirectToAction("UserDashBoard")); } else { return(View()); } } return(View()); }