0

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

2
Contributors
1
Reply
12
Views
4 Years
Discussion Span
Last Post by gusano79
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.