public async Task <IActionResult> Index() { var response = await _bus.Ask <CoursesCounterResponse>(new FindCoursesCounterQuery()); return(Ok(new Dictionary <string, int> { { "total", response.Total } })); }
public async Task <IEnumerable <BackofficeCourseResponse> > Index([FromQuery] FiltersParam param) { var courses = await _bus.Ask <BackofficeCoursesResponse>( new SearchBackofficeCoursesByCriteriaQuery(param.Filters, param.OrderBy, param.Order, param.Limit, param.Offset) ); return(courses.Courses); }
public void Handle_Query() { var fakeQuery = new Query(); var fakeModel = new Model(); var handler = new Mock <IQueryHandler <Query, Model> >(); handler .Setup(x => x.Handle(fakeQuery)) .Returns(fakeModel); _mockHandlerFactory .Setup(x => x.Resolve(typeof(IQueryHandler <Query, Model>))) .Returns(handler.Object); var result = _dispatcher.Ask(fakeQuery); Assert.Equal(result, fakeModel); }
public async Task <IActionResult> Index() { var counterResponse = await _bus.Ask <CoursesCounterResponse>(new FindCoursesCounterQuery()); ViewBag.Title = "Welcome"; ViewBag.Description = "CodelyTV - Backoffice"; ViewBag.CoursesCounter = counterResponse.Total; ViewBag.UUID = Guid.NewGuid().ToString(); return(View(VIEW)); }