Beispiel #1
0
        private static void SeedMainSections(FishSpinDaysDbContext context, MainSectionDto[] mainSectionDtos)
        {
            var mainSectionToCreate = mainSectionDtos
                                      .Select(ms => new MainSection
            {
                Name     = ms.Name,
                Sections = ms.Sections.Select(s => new Section
                {
                    Name = s
                }).ToArray()
            }).ToArray();

            context.MainSections.AddRange(mainSectionToCreate);
            context.SaveChanges();
        }
Beispiel #2
0
        private static void SeedPublication(FishSpinDaysDbContext context)
        {
            var author = context.Users.FirstOrDefault(u => u.UserName == "admin");

            var seaPublication = new Publication()
            {
                SectionId   = 1,
                Author      = author,
                Title       = "Sardinia: Holy Land",
                Description = @"How many times have we heard call our island HOLY LAND … how many times have we smug smile at the name aware of some nice catches … but how many times have we cursed his marine sterility … Often the holy land has asked “our blood”, night sleep of a few hours, cold water, burning sun, wind and launches with an average of missed catch really embarrassing. That’s why the holy land has defined as such, needs sacrifice …The days of easy catches are gone, indeed ever known. This report will be a tribute of images and colors to my land surrounded by some “fish” few words but many pictures. Unfortunately I go fishing only with my phone (in addition to rod and lures), otherwise the spectacle of nature, with a camera, would have come out in all its glory .." +
                              "<img src=\"http://www.seaspin.com/eng/wp-content/uploads/2015/11/TS32-.jpg\" style=\"width: 40%; float: left;\">" +
                              "The beauty of sunrises and sunsets … that is the holy land!!!!Nature gives us details of which I didn’t even know the existence.Moving on cliffs or through vegetation often happens to come across creatures that seem to come from the Amazon rainforest.Let’s say that the variety of fish is not lacking," +
                              "from small amberjack to greenhouse, from sea bass to dorado, from bonitos to the barracudas …" +
                              "This year every corner of the coast for a few days was registered in green gold, even dolphinfish lost its charm for the ease with which you could catch it.Last year or two years ago however very few managed so… I still remember well the bad feeling I had seeing them follow any kind of lure without attacking: I could have smashed the rod on the rocks.Then the choice of fishing with smaller baits sometimes saved me from a washout, making me go home with a pretty stupid smile on my face.",
            };

            context.Publications.Add(seaPublication);
            context.SaveChanges();
        }