public IActionResult Login(IndexLoginVM obj) { ViewBag.OeErrorMessage = null; try { var currentLoginDetails = _usersService.GetUserLogin(obj.OurEduId, obj.Password); //[NOTE:if login is not match] if (currentLoginDetails.OurEduId == null) { var model = new IndexLoginVM() { InstitutionName = "Shidlai Ashraf Secondary School, Brahmanpara, Cumilla", Logo = null }; ViewBag.msg = "Invalid User Information"; return(View("Login/Login", model)); } //[NOTE:Creating session and access the system actor wise.] else { var userAuthenticationList = _userAuthenticationsService.GetUserAuthenticationsByUserId(currentLoginDetails.Id); string result = "-1;"; if (userAuthenticationList != null) { foreach (var item in userAuthenticationList._UsersAuthencations) { result = result + item.ActorId.ToString() + ";"; } } string activeUser = (currentLoginDetails.Id).ToString(); HttpContext.Session.SetString("session_CurrentActiveUserId", activeUser); HttpContext.Session.SetString("session_UserName", currentLoginDetails.FirstName); HttpContext.Session.SetString("session_currentUserAuthentications", result); HttpContext.Session.SetString("session_currentActiveActorTab", "-1"); HttpContext.Session.SetString("session_currentUserOurEduDetailId", "-1"); HttpContext.Session.SetString("session_loginInstitutionName", "Shidlai Ashraf Secondary School, Brahmanpara, Cumilla"); return(RedirectToAction("Index", "Users", new { area = "Institution" })); } } catch (Exception ex) { ViewBag.OeErrorMessage = "ERROR101:Login - " + ex.Message; return(View("Login/Login")); } }
public IActionResult Index(LoginSpecification loginInput) { IndexLoginVM loggedIn = new IndexLoginVM(); if (loginInput.Username == "Admin" && loginInput.Password == "123") { loggedIn.IsLoggedIn = true; } else { loggedIn.IsLoggedIn = false; } return(View(loggedIn)); }
public IActionResult Index(LoginSpecification loginInput) { if (!ModelState.IsValid) { return(View(loginInput)); } IndexLoginVM loggedIn = new IndexLoginVM { IsLoggedIn = true }; //Ändra html i navbar? return(RedirectToAction("Index", "Home", loginInput)); }
public IActionResult Login(string msg = "") { ViewBag.OeErrorMessage = null; try { ViewBag.msg = msg; //var insInformation = _institutionServ.GetLicensesDetails(); //var LicenceDetails = _commonServ.CommLicence_getLicenseDetails(); var model = new IndexLoginVM() { //LicenceDetails = LicenceDetails, //InstitutionName = insInformation.Institution.Name, //Logo = insInformation.Institution.LogoPath }; return(View("Login/Login", model)); } catch (Exception ex) { ViewBag.OeErrorMessage = "ERROR101:Login - " + ex.Message; return(View("Login/Login")); } }