Example #1
0
 public Author Add(Author model)
 {
     try
     {
         _context.Authors.Add(model);
         _context.SaveChanges();
         return(model);
     }
     catch (Exception ex)
     {
         _logger.LogError(ex, ex.Message);
         return(null);
     }
 }
 public Book Add(Book model)
 {
     try
     {
         _context.Books.Add(model);
         _context.SaveChanges();
         return(model);
     }
     catch (Exception ex)
     {
         _logger.LogError(ex, ex.Message);
         return(null);
     }
 }
Example #3
0
 public void Save()
 {
     _db.SaveChanges();
 }