Ejemplo n.º 1
0
        public ActionResult SignUp(TFATERPWebApplication.Models.TfatPassModel u)
        {
            ViewBag.pass    = u.PassWords;
            ViewBag.conpass = u.ConfirmPassword;
            var errors = ModelState.Values.SelectMany(v => v.Errors);

            if (ModelState.IsValid)
            {
                string realCaptcha = Session["captcha"].ToString();
                if (u.Captcha == realCaptcha)
                {
                    if (u.Insert())
                    {
                        return(RedirectToAction("Newdatalist", "Company"));
                    }
                    else
                    {
                        ModelState.AddModelError("exist", "Email Id Already Exist.");
                    }
                }
                else
                {
                    ModelState.AddModelError("myerrorsummary", "Verification Code is Incorrect");
                }
            }


            if (!u.TermsAccepted)
            {
                ModelState.AddModelError("TermsAccepted", "You must accept the terms");
            }

            return(View(u));
        }
Ejemplo n.º 2
0
        public ActionResult Login(TFATERPWebApplication.Models.TfatPassModel u)
        {
            // this action is for handle post (login)
            //if (ModelState.IsValid) // this is check validity
            //{
            using (Dal.TFAT_WEBERPEntities dc = new Dal.TFAT_WEBERPEntities())
            {
                var v = dc.TfatPasses.Where(a => a.IDs.Equals(u.IDs) && a.PassWords.Equals(u.PassWords)).FirstOrDefault();

                if (v != null)
                {
                    Session["UserName"] = v.IDs.ToString();
                    return(RedirectToAction("Newdatalist", "Company"));
                }
                else
                {
                    ModelState.AddModelError("errormsg", "Login details are wrong.");
                }
            }
            //}
            return(View(u));
        }