Пример #1
0
        static void Main(string[] args)
        {
            using (var db = new firstdi_coppermineContext())
            {
                var query = (from user in db.CmineUsers
                             join albums in db.CmineAlbums on user.UserId equals albums.Owner
                             select new { user, albums })
                            .ToList()
                            .GroupBy(g => new { g.user })
                            .Select(g => new {
                    User   = g.Key.user,
                    Albums = g.Select(gg => gg.albums)
                });

                foreach (var user in query)
                {
                    Console.WriteLine(user.User.UserName);

                    foreach (var album in user.Albums)
                    {
                        Console.WriteLine($"\t{album.Title}");
                    }
                }
            }
        }
 public UserPhotosController(firstdi_coppermineContext mysql)
 {
     this.mysql = mysql;
 }
Пример #3
0
 public HomeController(ILogger <HomeController> logger, PhotoCoreContext db, firstdi_coppermineContext mysql)
 {
     _logger    = logger;
     this.db    = db;
     this.mysql = mysql;
 }