Exemplo n.º 1
0
        public ActionResult register(User user, HttpPostedFileBase userImage)
        {
            if (userImage != null)
            {
                string image = Guid.NewGuid().ToString().Substring(0, 6) + userImage.FileName;
                userImage.SaveAs(Server.MapPath("~/UploadedImages/") + image);
                user.Image = image;
            }

            tabledbEntities entites = new StudyTweets.tabledbEntities();

            entites.Users.Add(user);
            entites.SaveChanges();
            EmailMessaging.SendEmail(user.Email);
            return(RedirectToAction("Index", "Dashboard"));
        }
Exemplo n.º 2
0
        public ActionResult login(User user)
        {
            tabledbEntities entites = new StudyTweets.tabledbEntities();
            var             result  = entites.Users.Where(x => x.Email == user.Email && x.Paswword == user.Paswword).FirstOrDefault();

            if (result != null)
            {
                if (result.IsApproved == 1)
                {
                    Session["userid"] = result.UsersID;
                    return(RedirectToAction("Index", "Dashboard"));
                }
                else
                {
                    ViewBag.ErrorMessage = "Please Verify Account From Registered Email";
                }
            }
            else
            {
                ViewBag.ErrorMessage = "Wrong Username and Password";
            }

            return(View());
        }