public string UpdateRecsroom([FromBody] Recsroom Recsroom) { UserModel userInfo = SessionExtensionTool.GetObject <UserModel>(HttpContext.Session, "userInfo"); Dictionary <string, string> param = new Dictionary <string, string>(); // Recsroom 데이터 파싱 param.Add("SelectSubj", Recsroom.SelectSubj); param.Add("Title", Recsroom.Title); param.Add("OthbcAt", Recsroom.OthbcAt); param.Add("Content", Recsroom.Content); param.Add("bbs_id", Recsroom.Bbs_id); param.Add("AtchFileId", Recsroom.AtchFileId); param.Add("user_id", userInfo.user_id); string query = ""; query = "UPDATE OP_BBS SET " + "TITLE = @Title:VARCHAR" + ", UPDATE_DT = TO_CHAR(SYSDATE, 'yyyy/mm/dd hh:mi')" + ", CONTENTS = @Content:VARCHAR" + ", UPDUSR = @user_id:VARCHAR" + ", DOC_ID = @AtchFileId:VARCHAR" + ", OTHBC_AT = @OthbcAt:VARCHAR WHERE BBS_ID = @bbs_id:NUMBER"; //cud 처리할 때는 트랜잭션 시작해주어야함 using var transaction = _context.Database.BeginTransaction(); _commonDao.Update(query, param); transaction.Commit(); return("ok"); }
public string InsertRecsroom([FromBody] Recsroom Recsroom) { UserModel userInfo = SessionExtensionTool.GetObject <UserModel>(HttpContext.Session, "userInfo"); Dictionary <string, string> param = new Dictionary <string, string>(); // Recsroom 데이터 파싱 param.Add("SelectSubj", Recsroom.SelectSubj); param.Add("Title", Recsroom.Title); param.Add("OthbcAt", Recsroom.OthbcAt); param.Add("Content", Recsroom.Content); param.Add("AtchFileId", Recsroom.AtchFileId); param.Add("user_id", userInfo.user_id); string query = ""; query = "INSERT INTO OP_BBS " + "VALUES(NOTICE_SEQ.NEXTVAL" + ", @SelectSubj:VARCHAR" + ", " + _codeMngTool.getCode("BBS", "RECSROOM") + ", @Title:VARCHAR" + ", TO_CHAR(SYSDATE, 'yyyy/mm/dd hh:mi')" + ", 0" + ", @Content:VARCHAR" + ", @user_id:VARCHAR" + ", @AtchFileId:VARCHAR" + ", @OthbcAt:VARCHAR" + ", NULL" + ", NULL" + ", NULL)"; //cud 처리할 때는 트랜잭션 시작해주어야함 using var transaction = _context.Database.BeginTransaction(); _commonDao.Insert(query, param); transaction.Commit(); return("ok"); }