public static void ProcessedAndSentByCustoms()
        {
            using (var ctx = new EFExamples2Context())
            {
                var parcel       = ctx.Parcels.Find(1);
                var customs      = ctx.Werehouses.Single(x => x.Name == "Customs");
                var lastActivity = parcel.Activities.OrderByDescending(x => x.Timestamp).First();

                var readyActivity = new ReadyForSendActivity()
                {
                    Werehouse = customs,
                    Timestamp = lastActivity.Timestamp.AddDays(1),
                };

                var sendActivity = new SendActivity()
                {
                    Werehouse = customs,
                    Timestamp = lastActivity.Timestamp.AddDays(1).AddHours(1),
                };

                var handlerFactory = new ActivityHandlersFactory();
                handlerFactory.GetActivityHandler(readyActivity).Apply(parcel, readyActivity);
                handlerFactory.GetActivityHandler(sendActivity).Apply(parcel, sendActivity);

                ctx.SaveChanges();
            }
        }
        public static void ProcessedAndSentByCustoms()
        {
            using (var ctx = new EFExamples2Context())
            {
                var parcel       = ctx.Parcels.First();
                var customs      = ctx.Werehouses.Single(x => x.Name == "Customs");
                var kyiv         = ctx.Werehouses.Single(x => x.City == "Kyiv");
                var lastActivity = parcel.Activities.OrderByDescending(x => x.Timestamp).First();

                var readyActivity = new ReadyForSendActivity()
                {
                    Werehouse = customs,
                    Timestamp = lastActivity.Timestamp.AddDays(1),
                };

                var sendActivity = new SendActivity()
                {
                    Werehouse              = customs,
                    Timestamp              = lastActivity.Timestamp.AddDays(1).AddHours(1),
                    SentToWerehouse        = kyiv,
                    AdditionaldDeliveryFee = 4m,
                };

                parcel.Activities.Add(readyActivity);
                parcel.Activities.Add(sendActivity);

                parcel.Werehouse    = null;
                parcel.DeliveryFee += 4m;


                ctx.SaveChanges();
            }
        }
        protected override void Seed(EFExamples2.EFExamples2Context context)
        {
            var stockholm = new Werehouse()
            {
                Id   = 1,
                City = "Stockholm",
                Name = "Stockholm 1",
            };

            var wroclav = new Werehouse()
            {
                Id   = 2,
                City = "Wroclav",
                Name = "Meest Express Werehouse",
            };

            var customs = new Werehouse()
            {
                Id   = 3,
                City = "Dolgobichuv",
                Name = "Customs",
            };

            var kyiv = new Werehouse()
            {
                Id   = 4,
                City = "Kyiv",
                Name = "Kyiv 1",
            };

            context.Werehouses.Add(stockholm);
            context.Werehouses.Add(wroclav);
            context.Werehouses.Add(customs);
            context.Werehouses.Add(kyiv);

            var tufli = new Parcel()
            {
                Weight      = 1.4m,
                DeliveryFee = 6m,
                Id          = 1,
                Value       = 120,
            };

            var createTufli = new CreateActivity()
            {
                Id = 1,
                ExpectedDeliveryFee = 6,
                Parcel          = tufli,
                Price           = 120,
                Timestamp       = new DateTime(2019, 9, 10),
                Werehouse       = stockholm,
                Weight          = 1.4m,
                TargetWerehouse = kyiv
            };

            var readyForDeliveryToMeest = new ReadyForSendActivity()
            {
                Parcel    = tufli,
                Werehouse = stockholm,
                Timestamp = new DateTime(2019, 9, 10, 0, 0, 1),
            };

            var sentToMeest = new SendActivity()
            {
                Parcel          = tufli,
                Werehouse       = stockholm,
                Timestamp       = new DateTime(2019, 9, 10, 0, 0, 2),
                SentToWerehouse = wroclav,
            };

            var retreivedByMeest = new RetrieveActivity()
            {
                Parcel    = tufli,
                Werehouse = wroclav,
                Timestamp = new DateTime(2019, 9, 12),
            };

            var readyForDeliveryToCustoms = new ReadyForSendActivity()
            {
                Parcel    = tufli,
                Werehouse = wroclav,
                Timestamp = new DateTime(2019, 9, 13),
            };

            var sentToCustoms = new SendActivity()
            {
                Parcel          = tufli,
                Werehouse       = wroclav,
                Timestamp       = new DateTime(2019, 9, 13),
                SentToWerehouse = customs,
            };


            context.Parcels.Add(tufli);

            context.Activities.Add(createTufli);
            context.Activities.Add(readyForDeliveryToMeest);
            context.Activities.Add(sentToMeest);
            context.Activities.Add(retreivedByMeest);
            context.Activities.Add(readyForDeliveryToCustoms);
            context.Activities.Add(sentToCustoms);
        }