Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,662 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi;
I wrote Linq code below and there is a synthax error I didn't see where?
public IActionResult RevenueByMonth()
{
var result = context.Developers
.Where(opportunity => opportunity.Statut == "Closed")
.Where(opportunity => opportunity.DateSolde >= new DateTime(_currentYear, 1, 1)
&& opportunity => opportunity.DateSolde <= new DateTime(_currentYear, 12, 31))
.GroupBy(opportunity => opportunity.DateSolde.Month)
.OrderBy(opportunity => opportunity.Key)
.Select(group => new
{
Month = GetMonthAsText(group.Key, _currentYear),
Revenue = group.Count()
})
.ToList();
return Ok(JsonSerializer.Serialize(result, new JsonSerializerOptions
{
PropertyNamingPolicy = null
}));
}
The problem is here :
Do you have an idea because I don't see it?
Try...
.Where(opportunity => opportunity.DateSolde >= new DateTime(_currentYear, 1, 1)
&& opportunity.DateSolde <= new DateTime(_currentYear, 12, 31))