473,385 Members | 1,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to get Yesterday Date data using web api

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"

Expand|Select|Wrap|Line Numbers
  1. public database_WICs Getdatabase_WICs(DateTime UploadDate)
  2.  
  3.         {
  4.             string yesterday = DateTime.Today.AddDays(-1).ToShortDateString();
  5.             database_WICs database_wics = db.database_WICs.Find(d => d.UploadDate == yesterday);
  6.  
  7.  
  8.             if (database_wics == null)
  9.             {
  10.                 throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
  11.             }
  12.  
  13.             return database_wics;
  14.         }

any help would be very much appreciated.
Thanks
Oct 8 '13 #1
0 1134

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Yong Wang | last post by:
> Hi: > We have a database system. In the database, we have an > attribute called date0, which contains date data (format: > i. e. 2004-08-12). I wrote a script to fetch the data > in a...
4
by: Manny Chohan | last post by:
Hi Can anyone tell me how i can calculate yesterday date using asp? Thanks manny
1
by: George LAZAR | last post by:
how can I change the system current date (time) using c#? thank you George
2
by: Remi Caron | last post by:
Hi, I took over an Visual Object project (Visual Clipper) in that language there is a function to: Convert a string containing a 32-bit binary date to a date data type. That function is called...
0
by: Alen Hubtka | last post by:
Hello All, Can any one share the code to compare two date data using Java script?Please. I would like to compare two dates and findout there are greater than or less than each other. Thanks,...
3
by: natin | last post by:
Hi How do i display a date field using databind.eval ?
1
by: glenn | last post by:
Hi folks, I am doing an UPDATE to a table that has a field for a DATE data type. I am using MS Access. The UPDATE works fine but when I try to place the DATE field in the mix it blows up. ...
2
by: mtal | last post by:
as i have a csv file in this one field is having date data but when i am using sql loader to load the data in table i am getting a error massage , can anybody suggest me how i will load the data .
6
by: dkyadav80 | last post by:
Hi guys, I have a form in html , all description below: first: name of persion (input type box) second: job profile (input type box) third: experience from: list box (Month : Jan, Feb,.....
6
by: gozdeata | last post by:
hey there, i m trying to get only time information of a date type variable. i got a column in type of char, it keeps time info in hh:mm format - 5 characters when i tried to convert it to date...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.