Exemple #1
0
        public ActionResult DeleteConfirmed(decimal id)
        {
            MUSER mUSER = db.MUSER.Find(id);

            db.MUSER.Remove(mUSER);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "USERID,USERNAME,USERPASSWORD,USERIMAGE,USERSEX,USERBIRTHDAY,USEREMAIL")] MUSER mUSER)
 {
     if (ModelState.IsValid)
     {
         db.Entry(mUSER).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.USERID = new SelectList(db.VIP, "VIPID", "EXPIRETIME", mUSER.USERID);
     ViewBag.USERID = new SelectList(db.MUSICIAN, "USERID", "MUSICIANINTRO", mUSER.USERID);
     return(View(mUSER));
 }
Exemple #3
0
        // GET: MUSERs/Details/5
        public ActionResult Details(decimal id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MUSER mUSER = db.MUSER.Find(id);

            if (mUSER == null)
            {
                return(HttpNotFound());
            }
            return(View(mUSER));
        }
Exemple #4
0
        // GET: MUSERs/Edit/5
        public ActionResult Edit(decimal id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MUSER mUSER = db.MUSER.Find(id);

            if (mUSER == null)
            {
                return(HttpNotFound());
            }
            ViewBag.USERID = new SelectList(db.VIP, "VIPID", "EXPIRETIME", mUSER.USERID);
            ViewBag.USERID = new SelectList(db.MUSICIAN, "USERID", "MUSICIANINTRO", mUSER.USERID);
            return(View(mUSER));
        }
        public ActionResult Create([Bind(Include = "USERID,USERNAME,USERPASSWORD,USERIMAGE,USERSEX,USERBIRTHDAY,USEREMAIL")] MUSER mUSER)
        {
            if (mUSER.USERPASSWORD.Length < 17 && mUSER.USERPASSWORD.Length > 7)
            {
                if (ModelState.IsValid)
                {
                    var maxid = db.Database.SqlQuery <int>("select max(USERID) from MUSER").FirstOrDefault();
                    maxid++;//新的user的ID
                    mUSER.USERID = maxid;
                    db.MUSER.Add(mUSER);
                    ViewBag.id = maxid;
                    db.SaveChanges();
                    Session["account"]   = maxid;
                    ViewBag.createresult = "SUCCESS";

                    var songlist = new SONGLIST();
                    var max      = db.Database.SqlQuery <int>("select max(SONGLISTID) from SONGLIST").FirstOrDefault();
                    max++;//新的user的ID
                    songlist.SONGLISTID      = max;
                    songlist.SONGLISTNAME    = "我喜欢";
                    songlist.USERID          = mUSER.USERID;
                    songlist.COLLECTIONTIMES = 0;
                    db.SONGLIST.Add(songlist);
                    db.SaveChanges();

                    var usersonglist = new USERSONGLIST();
                    usersonglist.USERID     = mUSER.USERID;
                    usersonglist.SONGLISTID = max;
                    db.USERSONGLIST.Add(usersonglist);
                    db.SaveChanges();


                    return(RedirectToAction("Myinfo", "Home"));
                }

                ViewBag.USERID = new SelectList(db.VIP, "VIPID", "EXPIRETIME", mUSER.USERID);
                ViewBag.USERID = new SelectList(db.MUSICIAN, "USERID", "MUSICIANINTRO", mUSER.USERID);


                return(View(mUSER));
            }
            else
            {
                ViewBag.createresult = "ISNOTPASSWORD";
                return(View());
            }
        }
        public ActionResult Index(LoginSender msg)
        {
            MUSER temp = new MUSER();

            if (msg == null)
            {
                ViewBag.Error = "Empty account";
            }
            else
            {
                var isuser    = db.Database.SqlQuery <int>("select USERID from MUSER where USERID=" + msg.account).FirstOrDefault();
                var _password = db.Database.SqlQuery <string>("select USERPASSWORD from MUSER where USERID=" + msg.account).FirstOrDefault();

                ViewBag._password = _password;

                if (isuser == 0)
                {
                    ViewBag.Error = "Account wrong";
                    return(View());
                }
                else
                {
                    ViewBag._password = _password;

                    if (msg.password.CompareTo(_password) == 0)
                    {
                        // Store userID into session
                        //HttpContext.Session["account"] = msg.account;
                        HttpContext.Session.Add("account", isuser);
                        //Object s = HttpContext.Session["account"];
                        ViewBag.check = 1;

                        return(Redirect("~/Home/Index"));
                    }
                    else
                    {
                        ViewBag.Error = "Account or password wrong!";
                        return(View());
                    }
                }
            }

            return(Redirect("~/Home/Index"));
        }
        public ActionResult Event(EditSender msg)
        {
            var id = (int)Session["account"];

            ViewBag.id = id;
            var email = db.Database.SqlQuery <string>("select USEREMAIL from MUSER where USERID=" + id).FirstOrDefault();

            ViewBag.email = email;

            MUSER muser = db.MUSER.Find(id);

            muser.USERNAME        = msg.username;
            muser.USERSEX         = msg.gender;
            muser.USERBIRTHDAY    = msg.birthday;
            db.Entry(muser).State = EntityState.Modified;
            db.SaveChanges();
            ViewBag.isedit = "success";
            return(RedirectToAction("Myinfo", "Home"));
        }