public Board GetBoard(int boardNo) //1개의 게시글을 받아온다 { using (var db = new NoteDbContext(_configuration)) { return(db.Boards.FirstOrDefault(b => b.No == boardNo)); } }
public List <Board> GetList() { using (var db = new NoteDbContext(_configuration)) { return(db.Boards.OrderByDescending(b => b.No).ToList()); } }
public IOrderedQueryable <Board> GetBoardTracking() //페이징시 사용 { var db = new NoteDbContext(_configuration); var _board = db.Boards.AsNoTracking().OrderByDescending(b => b.No); return(_board); }
public IOrderedQueryable <Notice> GetNoticeTracking() { var db = new NoteDbContext(_configuration); var _notice = db.Notices.AsNoTracking().OrderByDescending(n => n.No); return(_notice); }
public User GetUser(string id) { using (var db = new NoteDbContext(_configuration)) { var data = db.Users.FirstOrDefault(u => u.UserId == id); return(data); } }
/// <summary> /// 공지사항 상세 출력 /// </summary> public Notice GetNotice(int noticeNo) { using (var db = new NoteDbContext(_configuration)) { var notice = db.Notices.FirstOrDefault(n => n.No.Equals(noticeNo)); return(notice); } }
/// <summary> /// 공지사항 리스트 출력 /// </summary> /// <returns></returns> public List <Notice> GetList() { using (var db = new NoteDbContext(_configuration)) { return(db.Notices .OrderByDescending(n => n.No) .ToList()); } }
/// <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 User GetUser(LoginViewModel model) { using (var db = new NoteDbContext(_configuration)) { var user = db.Users.FirstOrDefault(u => u.UserId.Equals(model.UserId) && u.Password.Equals(model.Password)); if (user != null) { return(user); } else { return(null); } } }
public List <User> GetNonActiveUser() { using (var db = new NoteDbContext(_configuration)) { var data = (from user in db.Users join boards in db.Boards on user.UserId equals boards.UserId where user.UserId == "ksg" select new User { UserId = user.UserId, Name = user.Name } ).ToList(); return(data); } }
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); } } }
public IOrderedQueryable <Board> GetBoardTracking(string searchName) { var db = new NoteDbContext(_configuration); return(db.Boards.AsNoTracking().Where(b => b.Title.Contains(searchName) || b.Content.Contains(searchName)).OrderByDescending(b => b.No)); }
public IOrderedQueryable <Notice> GetNoticeTracking(string searchName) { var db = new NoteDbContext(_configuration); return(db.Notices.AsNoTracking().Where(n => n.Title.Contains(searchName) || n.Content.Contains(searchName)).OrderByDescending(n => n.No)); }