예제 #1
0
        static void Main(string[] args)
        {
            // From 05 - 10 exercise are here!
            var context = new PhotographerContext();

            Console.WriteLine(context.Photographers.Count());

            //08.Tag attribute
            Tag tag = new Tag()
            {
                Label = "#Krushi"
            };

            context.Tags.Add(tag);

            try
            {
                context.SaveChanges();
            }
            catch (DbEntityValidationException e)
            {
                tag.Label = TagTransformer.Transform(tag.Label);
                context.SaveChanges();
            }
        }
예제 #2
0
        static void Main()
        {
            PhotographerContext context = new PhotographerContext();

            Console.WriteLine(context.Photographers.Count());
            context.SaveChanges();
            //Photographer gana =context.Photographers.Add( new Photographer
            //{
            //    UserName = "******",
            //    Password = "******",
            //    Email = "*****@*****.**",
            //    BirthDate = DateTime.Now.AddYears(-33),
            //    RegisterDate = DateTime.Now

            //});
            //Album pleven =context.Albums.Add( new Album
            //{
            //    Name = "Pleven",
            //    BackGroundColor = "Green",
            //    IsPublic = true,
            //    OwnerId = gana//?
            //});
            //context.SaveChanges();

            //Tag tagg = context.Tags.Add(new Tag
            //{
            //    Label = Console.ReadLine()
            //});
            //context.Tags.Add(tagg);


            //try
            //{
            //    context.SaveChanges();
            //}
            //catch (DbEntityValidationException e)
            //{
            //    tagg.Label = TagTransofrmer.Transform(tagg.Label);

            //    context.SaveChanges();

            //}
        }
예제 #3
0
        static void Main(string[] args)
        {
            var context = new PhotographerContext();

            Tag tag = new Tag {
                Label = "#krushii"
            };

            context.Tags.Add(tag);

            try
            {
                context.SaveChanges();
            }
            catch (DbEntityValidationException e)
            {
                tag.Label = TagTransofrmer.Transform(tag.Label);
                context.SaveChanges();
            }


            System.Console.WriteLine(context.Photographers.Count());
        }