Пример #1
0
        /// <summary>
        /// 데이터 저장, 수정, 답변 공통 메서드
        /// </summary>
        public int SaveOrUpdate(ArticleBase model, BoardWriteFormType formType)
        {
            int r = 0;

            // 파라미터 추가
            var p = new DynamicParameters();

            //[a] 공통
            p.Add("@Name", value: model.Name, dbType: DbType.String);
            p.Add("@Email", value: model.Email, dbType: DbType.String);
            p.Add("@Title", value: model.Title, dbType: DbType.String);
            p.Add("@Content", value: model.Content, dbType: DbType.String);
            p.Add("@Password", value: model.Password, dbType: DbType.String);
            p.Add("@Encoding", value: model.Encoding, dbType: DbType.String);
            p.Add("@Homepage", value: model.Homepage, dbType: DbType.String);
            p.Add("@FileName", value: model.FileName, dbType: DbType.String);
            p.Add("@FileSize", value: model.FileSize, dbType: DbType.Int32);
            p.Add("@Category", value: model.Category, dbType: DbType.String);

            p.Add("@UserName", value: model.UserName, dbType: DbType.String); // 사용자 아이디

            switch (formType)
            {
            case BoardWriteFormType.Write:
                //[b] 글쓰기 전용
                p.Add("@PostIp", value: model.PostIp, dbType: DbType.String);

                r = db.Execute("SupportsWrite", p, commandType: CommandType.StoredProcedure);
                break;

            case BoardWriteFormType.Modify:
                //[b] 수정하기 전용
                p.Add("@ModifyIp", value: model.ModifyIp, dbType: DbType.String);
                p.Add("@Id", value: model.Id, dbType: DbType.Int32);

                r = db.Execute("SupportsModify", p, commandType: CommandType.StoredProcedure);
                break;

            case BoardWriteFormType.Reply:
                //[b] 답변쓰기 전용
                p.Add("@PostIp", value: model.PostIp, dbType: DbType.String);
                p.Add("@ParentNum", value: model.ParentNum, dbType: DbType.Int32);

                r = db.Execute("SupportsReply", p, commandType: CommandType.StoredProcedure);
                break;
            }

            return(r);
        }
Пример #2
0
 public ArticleBase WriteModel(ArticleBase model)
 {
     throw new NotImplementedException();
 }
Пример #3
0
 public bool Edit(ArticleBase model)
 {
     throw new NotImplementedException();
 }