Dear all,
I am trying to implement a method in api controller which only gets the yesterday date's data. I am new c# and mvc programming and I am not sure how to go about executing this task. I started the date method but currently its not filtering the data as desired and throwing error such as "Cannot convert lambda expression to type 'object[]' because it is not a delegate type"
public database_WICs Getdatabase_WICs(DateTime UploadDate)
{
string yesterday = DateTime.Today.AddDays(-1).ToShortDateString();
database_WICs database_wics = db.database_WICs.Find(d => d.UploadDate == yesterday);
if (database_wics == null)
{
throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
}
return database_wics;
}
Any help would be very much appreciated.
Thank you