I have a controller to get a count of items that are greater then a certain date. The repository appears as:
public Dictionary<int, int> GetAllComplaintsCount(DateTime start)
{
try
{
return _context.Checklists
.Where(a => a.COMPLAINT.Received_DT > start)
.GroupBy(a => a.MonitorEnteredEmpID)
.ToDictionary(g => g.Key, g => g.Count());
}
catch (Exception ex)
{
_logger.LogError("Could not get am with checklist", ex);
return null;
}
}
Edit I've included my routers to see if it is correct:
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "crams/{controller=Home}/{action=Index}/{id?}");
routes.MapRoute(
name: "route",
template: "crams/{controller}/{action}/{start?}");
});
Question Without the start parameter, I am able to get http://localhost:8000/crams/api/counts through postman. I am unsure though, how to incorporate the date through postman so it can only pull dates that are greater than start.
I've tried
http://localhost:8000/crams/api/counts/2016-1-1 but it comes back null.