Beispiel #1
0
        public ActionResult Register(RegisterModel rm, PaysListModel pm)
        {
            if (ModelState.IsValid)

            {
                DataContext ctx = new DataContext(ConfigurationManager.ConnectionStrings["Cnstr"].ConnectionString);
                if (ctx.SaveSignUp(rm, pm))
                {
                    SessionUtils.IsLogged = true;
                    ViewBag.ErrorMessage  = "You can log in now!";
                    RegisterViewModel rvm = new RegisterViewModel();
                    return(View(rvm));
                }
                else
                {
                    ViewBag.ErrorMessage = "Try once again!";
                    return(View());
                }
            }
            else
            {
                ViewBag.ErrorMessage = "Sign Up error";
                RegisterViewModel rvm = new RegisterViewModel();
                return(View(rvm));
            }
        }
Beispiel #2
0
        public RegisterModel UserAuth(LoginModel lm)
        {
            RegisterEntity re = ((RegisterRepository)_registerRepo).GetFromLogin(lm.Login, lm.Password);

            if (re == null)
            {
                return(null);
            }
            if (re != null)
            {
                PaysListModel plm = new PaysListModel();
                return(new RegisterModel()
                {
                    Nom = re.Nom,
                    Prenom = re.Prenom,
                    Login = re.Login,
                    Email = re.Email,
                    Telephone = re.Telephone,
                    Pays = re.Libelle,
                    IdMembre = re.IdMembre,
                    Photo = re.Photo
                });
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        public bool SaveSignUp(RegisterModel rm, PaysListModel plm)
        {
            RegisterEntity r = new RegisterEntity();

            r.Nom       = rm.Nom;
            r.Prenom    = rm.Prenom;
            r.Email     = rm.Email;
            r.Login     = rm.Login;
            r.Password  = rm.Password;
            r.Telephone = rm.Telephone;
            r.IdPays    = plm.IdPays;
            r.IdMembre  = rm.IdMembre;
            return(_registerRepo.Insert(r));
        }
Beispiel #4
0
        public List <PaysListModel> SelectPays()
        {
            List <PaysListModel>  plm     = new List <PaysListModel>();
            List <PaysListEntity> allPays = _paysListRepo.Get();

            foreach (PaysListEntity pays in allPays)
            {
                PaysListModel pl = new PaysListModel();
                pl.IdPays  = pays.IdPays;
                pl.Libelle = pays.Libelle;
                plm.Add(pl);
            }
            return(plm);
        }