Пример #1
0
        public ActionResult DeleteOutput(G3_User A)
        {
            ViewBag.Message = "帳號刪除.結果";
            List <G3_User> list = new List <G3_User>();

            using (AIPEntities3 db = new AIPEntities3())
            {
                G3_User User = new G3_User();
                User = db.G3_User.Find(A.ID);

                if (User == null)
                {
                }
                else
                {
                    db.G3_User.Remove(User);
                    db.SaveChanges();
                }

                var reuslt = db.G3_User.ToList();
                foreach (var item in reuslt)
                {
                    G3_User user = new G3_User();
                    user.ID       = item.ID;
                    user.NAME     = item.NAME;
                    user.PASSWORD = item.PASSWORD;
                    user.SEX      = item.SEX;

                    list.Add(user);
                }
            }
            return(View(list));
        }
Пример #2
0
        public ActionResult RegisterOutput(G3_User A)
        {
            ViewBag.Message = "註冊.結果";

            List <G3_User> list = new List <G3_User>();

            using (AIPEntities3 db = new AIPEntities3())
            {
                var reuslt = db.G3_User.ToList();
                foreach (var item in reuslt)
                {
                    if (A.NAME == item.NAME)
                    {
                        return(RedirectToAction("Register"));
                    }
                }

                G3_User User = new G3_User();

                //User.ID = User.ID;
                User.NAME     = A.NAME;
                User.PASSWORD = A.PASSWORD;
                User.SEX      = A.SEX;

                db.G3_User.Add(User);
                db.SaveChanges();
            }

            return(View(A));
        }
Пример #3
0
        public ActionResult Delete()
        {
            ViewBag.Message = "帳號刪除";
            List <G3_User> list = new List <G3_User>();

            using (AIPEntities3 db = new AIPEntities3())
            {
                var reuslt = db.G3_User.ToList();
                foreach (var item in reuslt)
                {
                    G3_User user = new G3_User();
                    user.ID       = item.ID;
                    user.NAME     = item.NAME;
                    user.PASSWORD = item.PASSWORD;
                    user.SEX      = item.SEX;

                    list.Add(user);
                }
            }
            return(View(list));
        }
Пример #4
0
        public ActionResult id()
        {
            G3_User B = new G3_User();

            String strLoginID = User.Identity.Name;

            using (AIPEntities3 db = new AIPEntities3())
            {
                var reuslt = db.G3_User.ToList();
                foreach (var item in reuslt)
                {
                    if (strLoginID == item.NAME)
                    {
                        B.ID       = item.ID;
                        B.NAME     = item.NAME;
                        B.PASSWORD = item.PASSWORD;
                        B.SEX      = item.SEX;
                    }
                }
            }

            ViewBag.Message = strLoginID;
            return(View(B));
        }