public ActionResult LogOn(WebPortalLoginCredential model, string returnUrl, int? keep_logged) { bool RememberMe = true; if (keep_logged == null) RememberMe = false; if (ModelState.IsValid) { CloudWebPortalManagement a = new CloudWebPortalManagement(); if (a.loginToCloudWebPortal(model.Username, model.Password)) { FormsAuthentication.SetAuthCookie(model.Username, RememberMe); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return Redirect(returnUrl); } else { return RedirectToAction("Dashboard", "Home"); } } else { ModelState.AddModelError("", "The user name or password provided is incorrect."); } } return PartialView(model); }
public ActionResult CreatePost(WebPortalLoginCredential webportallogincredential) { if (ModelState.IsValid) { db.WebPortalLoginCredentials.Add(webportallogincredential); db.SaveChanges(); return RedirectToAction("Dashboard", "Home"); } return View("~/Views/Home/Dashboard.cshtml", webportallogincredential); }
public ActionResult EditPost(WebPortalLoginCredential webportallogincredential) { if (ModelState.IsValid) { db.Entry(webportallogincredential).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Dashboard", "Home"); } return View("~/Views/Home/Dashboard.cshtml", webportallogincredential); }