Beispiel #1
0
 public Note GetNote(int No)
 {
     using (var db = new BbsDbContext(_configuration))
     {
         var note = db.Notes.FirstOrDefault(x => x.No.Equals(No));
         return(note);
     }
 }
Beispiel #2
0
 public User GetUser(int Id)
 {
     using (var db = new BbsDbContext(_configuration))
     {
         var user = db.Users.FirstOrDefault(x => x.Id.Equals(Id));
         return(user);
     }
 }
Beispiel #3
0
        public bool PostNote(Note note)
        {
            using (var db = new BbsDbContext(_configuration))
            {
                db.Notes.Add(note);

                return((db.SaveChanges() > 0) ? true : false);
            }
        }
Beispiel #4
0
 public List <Note> GetNoteList()
 {
     using (var db = new BbsDbContext(_configuration))
     {
         // DB에서 연동하고 List 출력
         return(db.Notes.Include(x => x.User)
                .OrderByDescending(n => n.No)
                .ToList());
     }
 }