public ActionResult Login(LoginModel lm) { // I intanciate a MembreRepository with the connectionstring. // The connectionstring is stored into web.config and i get it with the ConfigurationManager MembreRepository Cr = new MembreRepository(ConfigurationManager.ConnectionStrings["CnstrDev"].ConnectionString); //I use the function VerifLogin from the MembreRepository //For use this function, I have to convert The LoginModel to the ProfileModel Mmodel = MapToDBModel.MemberToProfile(Cr.VerifLogin(MapToDBModel.LoginToMember(lm))); if (Mmodel != null) { SessionUtils.ConnectedUser = Mmodel; SessionUtils.IsConnected = true; return(RedirectToAction("Index", new { controller = "Home", area = "Membre" })); } else { ViewBag.ErrorLoginMessage = "Error Login or Password"; return(RedirectToAction("Index", new { controller = "Home", area = "" })); } }
public ActionResult Login(LoginModel m) { //I intanciate a MembreRepository with the connectionstring. // The connectionstring is stored into web.config and i get it with the ConfigurationManager // If you want more information about ConfigurationManager don't forget to use F12. MembreRepository Mr = new MembreRepository(ConfigurationManager.ConnectionStrings["CnstrDev"].ConnectionString); //I use the function VerifLogin from the MembreRepository //For use this function, I have to convert The LoginModel to the ProfileModel Mmodel = MapToDBModel.MemberToProfile(Mr.VerifLogin(MapToDBModel.LoginToMembre(m))); if (Mmodel != null) { SessionUtils.ConnectedUser = Mmodel; SessionUtils.IsConnected = true; return(RedirectToAction("Index", new { controller = "Home", area = "Membre" })); } else { ViewBag.ErrorLoginMessage = "Erreur Login/Mot de passe"; return(View()); } }