Esempio n. 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);
     }
 }
Esempio n. 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);
     }
 }
Esempio n. 3
0
        public bool PostNote(Note note)
        {
            using (var db = new BbsDbContext(_configuration))
            {
                db.Notes.Add(note);

                return((db.SaveChanges() > 0) ? true : false);
            }
        }
Esempio n. 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());
     }
 }