示例#1
0
        public void Test_InsertMonster()
        {
            var data     = new AdoData();
            var expected = new Model.Monster()
            {
                GenderID = 3, TitleID = 2, TypeID = 2, Name = "AdoInsert", PicturePath = "pathz", Active = false
            };
            var actual = data.InsertMonster(expected);

            Assert.True(actual);
        }
示例#2
0
        public bool InsertMonster(Model.Monster monster)
        {
            var n0    = new SqlParameter("GenderID", monster.GenderID);
            var n1    = new SqlParameter("TitleID", monster.TitleID);
            var n2    = new SqlParameter("TypeID", monster.TypeID);
            var n3    = new SqlParameter("Name", monster.Name);
            var n4    = new SqlParameter("PicturePath", monster.PicturePath);
            var n5    = new SqlParameter("Active", monster.Active);
            var query = "insert into Monster.Monster(GenderID,TitleID,TypeID,Name,PicturePath,Active) values (@GenderID,@TitleID,@TypeID,@Name,@PicturePath,@Active)";

            return(InsertData(query, n0, n1, n2, n3, n4, n5) == 1);
        }