public ActionResult Delete(int BoardNo) { List <Attachment> objList = attachmentService.Index(BoardNo); FileInfo fi; foreach (var list in objList) { try { var filePath = list.AttachmentPath; fi = new FileInfo(filePath); fi.Delete(); } catch (Exception e) { var errorMessage = e.ToString(); } } int affectedCount = boardService.Delete(BoardNo); if (affectedCount == 0) { return(Json(new { message = "no data" }, JsonRequestBehavior.AllowGet)); //return Redirect("Detail"); } else if (affectedCount == -1) { return(Json(new { message = "데이터 삭제 실패" }, JsonRequestBehavior.AllowGet)); } return(Json(new { status = "success" }, JsonRequestBehavior.AllowGet)); }
public int Delete(int boardId) { var map = mapper.CreateMapper(); BoardDTO board = BoardService.Get(boardId); int i = BoardService.Delete(board); return(i); }
public IActionResult Delete(int id) { var boardService = new BoardService(); int result = boardService.Delete(id); return(Json(new { code = 0, message = "OK" })); }
public void RuntTest() { // 기본 생성자 이용 int number = 1; string title = "첫 번째 게시글입니다."; string content = "첫 번째 공지사항입니다."; string writer = "운영자"; BoardService boardService = new BoardService(); boardService.Save(number, title, content, writer); boardService.Read(); Console.WriteLine("====="); title = "첫 번째 게시글 수정!!"; boardService.Update(title, content, writer); boardService.Read(); Console.WriteLine("====="); boardService.Delete(); boardService.Read(); Console.WriteLine("====="); // 생성자 오버로딩 이용 Board board = new Board(); board.Number = 2; board.Title = "두 번째 게시글입니다."; board.Content = "두 번째 공지사항입니다."; board.Writer = "운영자"; board.CreateDate = DateTime.Now; board.UpdateDate = DateTime.Now; BoardService anotherBoardService = new BoardService(board); anotherBoardService.Read(); }