public async Task <IActionResult> GetInvitationAsync(Guid invitationGuid) { _logger.LogDebug($"call: GetInvitationAsync({invitationGuid})"); await _guestsService.ReadInvitationAsync(invitationGuid); var invitation = await _guestsService.GetGuestsAsync() .Where(g => g.InvitationGuid == invitationGuid) .Select(g => new Invitation { InvitationGuid = g.InvitationGuid, FirstName = g.FirstName, LastName = g.LastName, InvitationSeen = g.InvitationSeen, IsGoing = g.IsGoing }).FirstOrDefaultAsync().ConfigureAwait(false); return(invitation != null?Ok(invitation) : (IActionResult)NotFound(invitation)); }
public async IAsyncEnumerable <Guest> GetGuestsAsync() { _logger.LogDebug($"call: GetGuestsAsync()"); await foreach (var g in _guestsService.GetGuestsAsync()) { yield return(new Guest { Id = g.Id, FirstName = g.FirstName, LastName = g.LastName, About = g.About, Img = $"api/guest/photo/{g.FirstName}_{g.LastName}", InvitationGuid = g.InvitationGuid, InvitationSentDateTime = g.InvitationSentDateTime, InvitationSeenDateTime = g.InvitationSeenDateTime, IsGoing = g.IsGoing }); } }