public ActionResult InsertUserToDatabase(User m) { if (ModelState.IsValid) { UserDal dal = new UserDal(); dal.users.Add(m); dal.SaveChanges(); return RedirectToAction("Angular", "Admin", new { area ="" }); } else { ModelState.AddModelError("No Data", "Please enter the UserName and Password"); return View("MainPage"); } }
public ActionResult Login() { //Forms Authentication string userName = Request.Form["UserName"].Trim(); string Password = Request.Form["Password"].Trim(); UserDal user = new UserDal(); List<User> users = (from u in user.users where (u.UserName == userName) && (u.Password == Password) select u).ToList<User>(); if (users.Count == 1) { FormsAuthentication.SetAuthCookie(userName,true); return RedirectToAction("Index", "Admin", new { area = "" }); } else { ModelState.AddModelError("No Data", "Please enter the correct UserName and Password"); return View(); } }
public ContentService() { _db = new UserDal(); }