public async Task <Response> Handle(Request request, CancellationToken cancellationToken) => new Response() { Commitments = await _context.Commitments .Include(x => x.CommitmentFrequencies) .Include("CommitmentFrequencies.Frequency") .Include("CommitmentFrequencies.Frequency.FrequencyType") .Where(x => x.ProfileId == request.ProfileId && x.CommitmentFrequencies.Any(f => f.Frequency.FrequencyType.Name == "per day")) .Select(x => CommitmentApiModel.FromCommitment(x)).ToListAsync() };
public async Task <Response> Handle(Request request, CancellationToken cancellationToken) => new Response() { Commitments = await _context.Commitments .Include(x => x.Behaviour) .Include("Behaviour.BehaviourType") .Include(x => x.CommitmentFrequencies) .Include("CommitmentFrequencies.Frequency") .Include("CommitmentFrequencies.Frequency.FrequencyType") .Select(x => CommitmentApiModel.FromCommitment(x)).ToListAsync() };
public async Task <Response> Handle(Request request, CancellationToken cancellationToken) => new Response() { Commitment = CommitmentApiModel.FromCommitment(await _context.Commitments.FindAsync(request.CommitmentId)) };
public async Task <Response> Handle(Request request, CancellationToken cancellationToken) => new Response() { Commitments = await _context.Commitments.Select(x => CommitmentApiModel.FromCommitment(x)).ToListAsync() };