c# - having difficulty searching for a date -


i having problems searching through list of dates, results of search not appearing. variable appointment date has been saved on database datetime. code have in controller:

public actionresult index(datetime searchdate) {     var query = in db.appointmentprocedures                 a.bookingstatus == false                 orderby a.appointmentstarttime                 select a;      if (searchdate != null)     {         query = in db.appointmentprocedures                 orderby a.appointmentdate                 a.appointmentdate <= searchdate                 select a;     }      return view(query); } 

this error continue running in to:

the model item passed dictionary of type 'system.data.entity.infrastructure.dbquery`1[system.datetime]', dictionary requires model item of type 'system.collections.generic.ienumerable`1[laserculptfinal.models.appointmentprocedure]' 

looks want pass model list of smth passing query because haven't enumerated example this.

public actionresult index(datetime searchdate) {     .....          return view(query.tolist()); } 

it if you've showed model view needs


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -