Exemplo n.º 1
0
        public static void Add(int ID, string Name, string Psw)
        {
            kemuyiEntities db = new kemuyiEntities();

            db.Users.Add(new Users()
            {
                ID = ID, Name = Name, Password = Psw
            });
            db.SaveChanges();
        }
Exemplo n.º 2
0
        public static void Add(int QuestionID, string Content, string Answer)
        {
            kemuyiEntities db = new kemuyiEntities();

            db.Question.Add(new Question()
            {
                QuestionID = QuestionID, Content = Content, Answer = Answer
            });
            db.SaveChanges();
        }
Exemplo n.º 3
0
        public static bool Updata(int ID, string Name, string Psw)
        {
            kemuyiEntities db   = new kemuyiEntities();
            var            user = db.Users.Find(ID);

            user.Name     = Name;
            user.Password = Psw;
            db.SaveChanges();

            return(false);
        }
Exemplo n.º 4
0
        public static bool Updata(int QuestionID, string Content, string Answer)
        {
            kemuyiEntities db       = new kemuyiEntities();
            var            Question = db.Question.Find(QuestionID);

            Question.Content = Content;
            Question.Answer  = Answer;
            db.SaveChanges();

            return(false);
        }
Exemplo n.º 5
0
        public static bool Delete(int ID)
        {
            kemuyiEntities db   = new kemuyiEntities();
            var            user = new Users {
                ID = ID
            };

            db.Users.Attach(user);
            db.Users.Remove(user);
            db.SaveChanges();

            return(false);
        }
Exemplo n.º 6
0
        public static bool Delete(int QuestionID)
        {
            kemuyiEntities db       = new kemuyiEntities();
            var            Question = new Question {
                QuestionID = QuestionID
            };

            db.Question.Attach(Question);
            db.Question.Remove(Question);
            db.SaveChanges();

            return(false);
        }