public async Task <ActionResult <ActivityDto> > Details(Guid Id) { var details = new Details.Query(); details.Id = Id; return(await Mediator.Send(details)); }
public async Task <ActivityDto> Single([FromRoute] Details.Query query) { var cacheKey = query.Id.ToString(); ActivityDto activity; string serializedActivity; var encodedActivity = await _cache.GetAsync(cacheKey); if (encodedActivity != null) { serializedActivity = Encoding.UTF8.GetString(encodedActivity); activity = JsonSerializer.Deserialize <ActivityDto>(serializedActivity); } else { activity = await Mediator.Send(query); serializedActivity = JsonSerializer.Serialize(activity); encodedActivity = Encoding.UTF8.GetBytes(serializedActivity); var option = new DistributedCacheEntryOptions() .SetSlidingExpiration(TimeSpan.FromMinutes(2)) .SetAbsoluteExpiration(DateTimeOffset.Now.AddHours(1)); await _cache.SetAsync(cacheKey, encodedActivity, option); } return(activity); }
public async Task <ActionResult <Activity> > Details(Guid id) { var query = new Details.Query() { Id = id }; return(await _mediator.Send(query)); }
public async Task <IActionResult> GetActivity(Guid id) { var detailsQuery = new Details.Query { Id = id }; var result = await Mediator.Send(detailsQuery); return(HandleResult(result)); }
public async Task <ActionResult <Profile> > Get([FromRoute] Details.Query query) { return(await Mediator.Send(query)); }
public async Task <ActionResult <Activity> > Details(Guid id, Details.Query query) { query.Id = id; return(await _mediator.Send(query)); }