Exemple #1
0
        // 수정
        public Maxim UpdateMaxim(Maxim model)
        {
            string sql = @"Update Maxims 
                Set Name = @Name, Content = @Content Where Id = @Id";

            this.db.Execute(sql, model);
            return(model);
        }
Exemple #2
0
        // 입력
        public Maxim AddMaxim(Maxim model)
        {
            string sql = @"
                Insert Into Maxims (Name, Content) Values (@Name, @Content);
                Select Cast(SCOPE_IDENTITY() As Int);
            ";
            var    id  = this.db.Query <int>(sql, model).Single();

            model.Id = id;
            return(model);
        }
Exemple #3
0
        // 입력
        public Maxim AddMaxim(Maxim model)
        {
            //[!] 새로운 데이터 저장 후 일련번호(Identity) 값을 반환 받아 모델 클래스에 채움
            string sql = @"
                Insert Into Maxims (Name, Content) Values (@Name, @Content);
                Select Cast(SCOPE_IDENTITY() As Int);
            ";
            var    id  = this.db.Query <int>(sql, model).Single();

            model.Id = id;
            return(model);
        }