public bool UpdateTopic(int id, [FromBody] CreateTopicCommand request)
        {
            TopicContext       context = HttpContext.RequestServices.GetService(typeof(TopicContext)) as TopicContext;
            UpdateTopicHandler handler = new UpdateTopicHandler(context);

            return(handler.Handle(id, request));
        }
        public Topic.Model.Topic GetTopicById(int id)
        {
            TopicContext        context = HttpContext.RequestServices.GetService(typeof(TopicContext)) as TopicContext;
            GetTopicByIdHandler handler = new GetTopicByIdHandler(context);

            return(handler.Handle(id));
        }
        public IEnumerable <Topic.Model.Topic> GetTopicsByCourseId(int id)
        {
            TopicContext context = HttpContext.RequestServices.GetService(typeof(TopicContext)) as TopicContext;
            GetTopicsByCourseIdHandler handler = new GetTopicsByCourseIdHandler(context);

            return(handler.Handle(id));
        }
        public IEnumerable <Topic.Model.Topic> GetAllTopics()
        {
            TopicContext        context = HttpContext.RequestServices.GetService(typeof(TopicContext)) as TopicContext;
            GetAllTopicsHandler handler = new GetAllTopicsHandler(context);

            return(handler.Handle());
        }
        public bool DeleteTopic(int id)
        {
            TopicContext        context          = HttpContext.RequestServices.GetService(typeof(TopicContext)) as TopicContext;
            GetTopicByIdHandler handlerGetCourse = new GetTopicByIdHandler(context);
            int courseId = handlerGetCourse.Handle(id).CourseId;
            DeleteTopicHandler handler = new DeleteTopicHandler(context);

            return(handler.Handle(id, courseId));
        }
        public DbMigrator UsingConnectionStringName(string connectionStringName)
        {
            DbContextOptionsBuilder <TopicContext> options = new DbContextOptionsBuilder <TopicContext>();

            options
            .UseSqlServer(this.Configuration.GetConnectionString(connectionStringName));

            Context = new TopicContext(options.Options);

            return(this);
        }
 public HomeController(TopicContext repo)
 {
     Repo = repo;
 }
Exemple #8
0
 public BaseRepository(TopicContext context)
 {
     _context = context;
 }
 public GetTopicsByCourseIdHandler(TopicContext context)
 {
     _context = context;
 }
 public GetAllTopicsHandler(TopicContext context)
 {
     _context = context;
 }
Exemple #11
0
 public DeleteTopicHandler(TopicContext context)
 {
     _context = context;
 }
 public CreateTopicHandler(TopicContext context)
 {
     _context = context;
 }
Exemple #13
0
 public TopicRepository(IOptions <Settings> settings)
 {
     _topicContext = new TopicContext(settings);
 }
 public ArticleCategoryRepository(TopicContext context) : base(context)
 {
 }
Exemple #15
0
 public GetTopicByIdHandler(TopicContext context)
 {
     _context = context;
 }