/// <summary> /// 공지사항 등록 /// </summary> public bool SaveNotice(Notice notice) { using (var db = new NoteDbContext(_configuration)) { db.Notices.Add(notice); if (db.SaveChanges() >= 1) { return(true); } return(false); } }
public bool SaveBoard(Board board) { using (var db = new NoteDbContext(_configuration)) { db.Boards.Add(board); if (db.SaveChanges() >= 1) { return(true); } return(false); } }
public bool SaveUser(User model) { using (var db = new NoteDbContext(_configuration)) { db.Users.Add(model); if (db.SaveChanges() >= 1) { return(true); } else { throw new ArgumentException(); } } }
public bool DeleteBoard(int boardNo) { using (var db = new NoteDbContext(_configuration)) { db.Remove(GetBoard(boardNo)); if (db.SaveChanges() >= 1) { return(true); } else { return(false); } } }
public bool DeleteNotice(int noticeNo) { using (var db = new NoteDbContext(_configuration)) { var _noticeNo = db.Notices.First(n => n.No == noticeNo); db.Notices.Remove(_noticeNo); if (db.SaveChanges() >= 1) { return(true); } else { return(false); } } }
/// <summary> /// 공지사항 수정 /// </summary> public bool UpdateNotice(Notice notice) { using (var db = new NoteDbContext(_configuration)) { var _notice = db.Notices.First(n => n.No == notice.No); _notice.Title = notice.Title; _notice.Content = notice.Content; if (db.SaveChanges() >= 1) { return(true); } else { return(false); } } }
public bool UpdateBoard(Board board) { using (var db = new NoteDbContext(_configuration)) { var _board = db.Boards.First(b => b.No == board.No); _board.Title = board.Title; _board.Content = board.Content; if (db.SaveChanges() >= 1) { return(true); } else { return(false); } } }