public async Task InitializeAsync()
    {
      await _ctx.Database.EnsureCreatedAsync();

      if (!_ctx.Stories.Any())
      {
        // Create Data
        if (_environ.IsDevelopment())
        {
          var user = new WilderUser()
          {
            UserName = "******",
            Email = "*****@*****.**",
            EmailConfirmed = true
          };
          await _mgr.CreateAsync(user, "P@ssw0rd!");

          var story = new Story()
          {
            Body = "<p>Test Story</p>",
            DatePosted = DateTime.UtcNow,
            IsPublished = true,
            Permalink = Guid.NewGuid().ToString(),
            Title = "Welcome to My Blog"
          };

          _ctx.Stories.Add(story);
          await _ctx.SaveChangesAsync();
        }
      }
    }
Beispiel #2
0
    private async Task MigrateStory(Story story)
    {
      FixBody(story.Body);

      await _repo.AddStory(new BlogStory()
      {
        Title = story.Title,
        Body = story.Body,
        DatePublished = story.DatePosted,
        IsPublished = story.IsPublished,
        UniqueId = story.Permalink,
        Slug = story.GetSlug(),
        Categories = story.Categories.Select(s => s.Name).ToList()
      });

      foreach (var comment in story.Comments)
      {
        MigrateComment();
      }
    }