Esempio n. 1
0
 public ActionResult Register(TBLUser p)
 {
     if (!ModelState.IsValid)
     {
         return(View("Register"));
     }
     db.TBLUser.Add(p);
     db.SaveChanges();
     return(RedirectToAction("Login", "Login"));
 }
Esempio n. 2
0
 public ActionResult AddUser(TBLUser p)
 {
     if (!ModelState.IsValid)
     {
         return(View("AddUser"));
     }
     db.TBLUser.Add(p);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Esempio n. 3
0
        public ActionResult Index2(TBLUser p)
        {
            var email = (string)Session["u_email"];
            var user  = db.TBLUser.FirstOrDefault(x => x.u_email == email);

            user.u_name           = p.u_name;
            user.u_surname        = p.u_surname;
            user.u_password       = p.u_password;
            user.u_preferenceList = p.u_preferenceList;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
        public ActionResult AddUser(TBLUser p)
        {
            db.TBLUser.Add(p);
            var loc = db.Libraries.Where(a => a.LibrariesID == p.Libraries.LibrariesID).FirstOrDefault();

            p.Libraries = loc;



            db.SaveChanges();
            return(View("Index"));
        }
Esempio n. 5
0
        public ActionResult UpdateUser(TBLUser p)
        {
            var user = db.TBLUser.Find(p.u_id);

            user.u_name           = p.u_name;
            user.u_surname        = p.u_surname;
            user.u_email          = p.u_email;
            user.u_password       = p.u_password;
            user.u_preferenceList = p.u_preferenceList;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 6
0
        public ActionResult SaveUser(TBLUser p)
        {
            var getir = db.TBLUser.Find(p.UserID);

            getir.UserName     = p.UserName;
            getir.UserSurname  = p.UserSurname;
            getir.UserMail     = p.UserMail;
            getir.UserUsername = p.UserUsername;
            getir.UserPassword = p.UserPassword;
            getir.UserPicture  = p.UserPicture;
            getir.UserPhone    = p.UserPhone;
            getir.UserSchool   = p.UserSchool;
            getir.UserDetail   = p.UserDetail;


            var loc = db.Libraries.Where(b => b.LibrariesID == p.Libraries.LibrariesID).FirstOrDefault();

            getir.LibraryID = loc.LibrariesID;

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 7
0
        public ActionResult Login(TBLUser p)
        {
            var info = db.TBLUser.FirstOrDefault(x => x.u_email == p.u_email && x.u_password == p.u_password);

            if (info != null)
            {
                if (string.Equals(p.u_email.ToString(), "admin@admin") && string.Equals(p.u_password.ToString(), "admin"))
                {
                    return(RedirectToAction("Index", "Movie"));
                }
                else
                {
                    Console.WriteLine();
                    FormsAuthentication.SetAuthCookie(info.u_email, false);
                    Session["u_email"] = info.u_email.ToString();
                    return(RedirectToAction("Index", "UserPage"));
                }
            }
            else
            {
                return(View());
            }
        }