using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using Domain;

namespace ConsoleTestApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ctx = new DataBaseContext();
            var user = new User
                       {
                           UserValue = "user1",
                       };
            user.Customer = new Customer
                            {
                                CustomerId = user.Id,
                                CustomerValue = "customer1",
                                Image = new Image
                                        {
                                            ImageValue = "image1"
                                        }
                            };


            ctx.Users.Add(user);
            ctx.SaveChanges();



            //var user2 = new Customer
            //            {
            //                UserValue = "user2"
            //            };
            //ctx.Users.Add(user2);

            //ctx.SaveChanges();

            //foreach (var singleUser in ctx.Users)
            //{
            //    Console.WriteLine(singleUser.UserId + " " + singleUser.UserValue);
            //    if (singleUser.Image != null)
            //    {
            //        Console.WriteLine(" - " + singleUser.Image.ImageValue + " " + singleUser.Image.ImageId);
            //    }
            //}

            //Console.WriteLine("----images----");

            //foreach (var singleImage in ctx.Images)
            //{
            //    Console.WriteLine("Image: "+singleImage.ImageId+" "+singleImage.ImageValue);
            //    if (singleImage.Customer != null)
            //    {
            //        Console.WriteLine("    "+singleImage.Customer.UserId + " " + singleImage.Customer.UserValue);
            //    }
            //}

        }
    }
}
