public async Task <ActionResult> Index(GetActivitiesQuery query) { var response = await _mediator.SendAsync(query); var model = _mapper.Map <ActivitiesViewModel>(response); return(View(model)); }
public async Task <PagedResults <ActivityDto> > Handle(GetActivitiesQuery request, CancellationToken cancellationToken) { if (String.IsNullOrWhiteSpace(request.Search)) { return(await _activityRepository.GetListPageAsync(request, null)); } else { return(await _activityRepository.GetListPageAsync(request, p => p.ContenuAct.ToLower().StartsWith(request.Search))); } }
public void Arrange() { _activitiesClient = new Mock<IActivitiesClient>(); _activitiesClient.Setup(c => c.GetActivities(It.IsAny<ActivitiesQuery>())).ReturnsAsync(_activitiesResult); _query = new GetActivitiesQuery { AccountId = AccountId, Take = 100, From = DateTime.UtcNow.AddDays(-1), To = DateTime.UtcNow, Term = "Foo Bar", Category = ActivityTypeCategory.Unknown, Data = new Dictionary<string, string> { ["Foo"] = "Bar" } }; _handler = new GetActivitiesQueryHandler(_activitiesClient.Object); }
public async Task <List <Activity> > Handle(GetActivitiesQuery request, CancellationToken cancellationToken) { return(await _context.Activities.ToListAsync()); }
public async Task <IEnumerable <StravaActivity> > Handle(GetActivitiesQuery request, CancellationToken cancellationToken) { return(await _stravaService.GetActivities()); }
public async Task <ActionResult <PagedResults <ActivityDto> > > GetActivitysAsync([FromQuery] GetActivitiesQuery query) { return(await QueryAsync <PagedResults <ActivityDto> >(query)); }