示例#1
0
        public ActionResult Regiter(tbl_usersignup u, HttpPostedFileBase imgfile)
        {
            try
            {
                string s = uploadimgfile(imgfile);
                if (s.Equals("-1"))
                {
                    Response.Write("<script> alert('Image uploading failed......') <script>");
                }
                else
                {
                    tbl_usersignup ur = new tbl_usersignup();
                    ur.u_name           = u.u_name;
                    ur.u_Eamil          = u.u_Eamil;
                    ur.u_Password       = u.u_Password;
                    ur.Conform_Password = u.Conform_Password;
                    ur.Image            = s;
                    ur.u_Contact        = u.u_Contact;

                    db.tbl_usersignup.Add(ur);
                    db.SaveChanges();


                    return(RedirectToAction("Index", "Home"));
                }
                Response.Write("<script> alert('Registeration Successfull') <script>");
            }
            catch (Exception)
            {
                //throw;
            }
            return(View());
        }
示例#2
0
        public ActionResult login(tbl_usersignup user)
        {
            tbl_usersignup u = db.tbl_usersignup.Where(x => x.u_Eamil == user.u_Eamil && x.u_Password == user.u_Password).SingleOrDefault();

            if (u != null)
            {
                Session["u_id"]      = u.u_id;
                TempData["username"] = u.u_name;

                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                TempData["Valid"] = "Invalid user or Password";
                return(RedirectToAction("Index", "Home"));
            }
        }