I have a Take property that if I pass a number I want to show for example top (4) and when the Take is 0 I want to return all, this is my code that is returning Top 4 when I pass Take = 4 but when Take is 0 I dont know how to return all.
var Notes = await zigzyDbContext.RealEstateAgentNotes
.Include(i => i.RealEstateAgent)
.Where(w => w.RealEstateAgent.Guid == request.RealEstateAgentGuid)
.Join(zigzyDbContext.SupportUsers,
j => j.CreatedById,
j => j.Id,
(j, k) => new
{
RealEstateAgentNote = j,
Support = k
})
.Where(w => w.Support != null)
.OrderByDescending(o => o.RealEstateAgentNote.CreatedDate)
.Take(request.Take)
.ToListAsync();
and this is the request property:
public Guid RealEstateAgentGuid { get; set; }
public int Take { get; set; }