public PostController() { _postRepo = new EfPostRepository(); _appUserRepo = new EfAppUserRepository(); _likeRepo = new EfLikeRepository(); _commentRepo = new EfCommentRepository(); }
public PostController() { _postRepo = new EfPostRepository(); _categoryRepo = new EfCategoryRepository(); _appUserRepo = new EfAppUserRepository(); _commentRepo = new EfCommentRepository(); }
public CommentController() { _commentRepo = new EfCommentRepository(); _appUserRepo = new EfAppUserRepository(); _postRepo = new EfNewsArticleRepository(); _likeRepo = new EfLikeRepository(); }
public object GetService(Type serviceType) { if (serviceType == typeof(UsersController)) { var dbContext = new BlogContext(); var repository = new EfUserRepository(dbContext); return(new UsersController(repository)); } else if (serviceType == typeof(PostsController)) { var dbContext = new BlogContext(); var postRepository = new EfPostRepository(dbContext); var userRepository = new EfUserRepository(dbContext); var tagRepository = new EfTagRepository(dbContext); var commentRepository = new EfCommentRepository(dbContext); return(new PostsController( userRepository, postRepository, tagRepository, commentRepository)); } else if (serviceType == typeof(TagsController)) { var dbContext = new BlogContext(); var tagRepository = new EfTagRepository(dbContext); var userRepository = new EfUserRepository(dbContext); return(new TagsController(tagRepository, userRepository)); } else { return(null); } }