예제 #1
0
 public MenuRightViewComponent(BlogCoreContext context)
 {
     _context = context;
 }
예제 #2
0
 public LoginController(BlogCoreContext context)
 {
     _context = context;
 }
예제 #3
0
 public PostController(BlogCoreContext context)
 {
     _context = context;
 }
예제 #4
0
 public CategoryController(BlogCoreContext context)
 {
     _context = context;
 }
        public static void SeedForTests(BlogCoreContext context)
        {
            context.Authors.Add(new Author
            {
                FirstName = "David",
                LastName  = "Lebee",
                Posts     = new List <Post>()
                {
                    new Post()
                    {
                        CreateTime  = DateTimeOffset.Now,
                        PublishTime = DateTimeOffset.Now,
                        Title       = "New project",
                        Content     = "Lots of good things coming",
                        Comments    = new List <Comment>()
                        {
                            new Comment()
                            {
                                DisplayName = "John Doe",
                                Email       = "*****@*****.**",
                                CommentText = "Very interesting",
                            },
                            new Comment()
                            {
                                DisplayName = "Nice Guy",
                                Email       = "*****@*****.**",
                                CommentText = "Best of luck!"
                            }
                        }
                    },
                    new Post()
                    {
                        CreateTime  = DateTimeOffset.Now,
                        PublishTime = null,
                        Title       = "The future!",
                        Content     = "Is Near"
                    }
                }
            });

            context.Authors.Add(new Author
            {
                FirstName = "Some",
                LastName  = "Dude",
                Posts     = new List <Post>()
                {
                    new Post()
                    {
                        CreateTime  = DateTimeOffset.Now,
                        PublishTime = DateTimeOffset.Now,
                        Title       = "The One",
                        Content     = "And Only"
                    },
                    new Post()
                    {
                        CreateTime  = DateTimeOffset.Now,
                        PublishTime = DateTimeOffset.Now,
                        Title       = "The Two",
                        Content     = "And Second"
                    }
                }
            });

            context.SaveChanges();
        }
예제 #6
0
 public UsersController(BlogCoreContext context)
 {
     _context = context;
 }
예제 #7
0
 public HomeController(ILogger <HomeController> logger, BlogCoreContext context)
 {
     _logger  = logger;
     _context = context;
 }