示例#1
0
文件: Program.cs 项目: KanXxw46/Hw_13
 static void ShowDebtors()
 {
     using (BestLibraryEntities db = new BestLibraryEntities())
     {
         Console.WriteLine("--------------- Debtors ---------------");
         var debtors = db.Customers.Where(c => c.IsDebtor == true);
         foreach (var item in debtors)
         {
             Console.WriteLine($"{item.FirstName} {item.LastName}");
         }
     }
 }
示例#2
0
文件: Program.cs 项目: KanXxw46/Hw_13
            static void ShowAuthors()
            {
                using (BestLibraryEntities db = new BestLibraryEntities())
                {
                    Console.WriteLine("--------------- Authors ---------------");
                    var authors = from a in db.BooksInLibrary
                                  join b in db.Authors on
                                  a.Id_author equals b.Id

                                  where a.Id_book == 3
                                  select new { FN = b.FirstName, LN = b.LastName };

                    foreach (var item in authors)
                    {
                        Console.WriteLine($"{item.FN} {item.LN}");
                    }
                }
            }