c# - linq: check if there are entries from the same day or week in a particular table -


so want number of entries in database form selected date , week day in. both database column , variable datetime fields. method date is:

private int multiuse_timesinaday()     {            daydate date = currentdate.date;         var submitcount = campaignmessages in dccrdata.mytable                            campaignmessages.created == date                            select campaignmessages;         int count = submitcount.count();          return count;     } 

and i'm kinda lost on how week search. ideas?

//first last monday i.e. start of week  int delta = dayofweek.monday - currentdate.date.dayofweek; datetime monday = currentdate.date.adddays(delta);   var submitcount = campaignmessages in dccrdata.mytable                    campaignmessages.created >= monday &&  campaignmessages.created <= monday.adddays(7)                       select campaignmessages;  

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -