c# - Cannot implicitly convert type 'System.Linq.IQueryable<Project.Models.TaskTimeLine>' to 'Project.Models.TaskTimeLine' -


I am trying to pass a custom shape square in a view, but I'm having some difficulty.

This is the error I am getting.

"System.Linq.IQueryable '' project. Models can not be converted to converted to 'TaskTimeLine'. A clear conversion exists (are not you leaving an artist?)

This is the first time when I've added a list to a class, and passed it as the second one Have tried to.

Here is a class definition

  Public class tasktime line {public work {get} Set; } // List for keeping a single object public & lt; DateTime & gt; Scheduled Time {Received; Set; } // To organize the collection of the date ..}  

The operation of the controller is on the lines of this.

  [Authorized] Public Transaction Details Description 2 (Int ID) {Task Timeline Task = New Task Timeline (); // Create a new instance of TaskTimeLine Task = (IQueryable & lt; TaskTimeLine & gt;) taskRepository.GetTaskAndTimeLine (ID); See Return (Task == Faucet) ("NotFound"); See more return ("description", work); }  

So far, all are quite normal, so I'm guessing something is going wrong.

  Public IQueryable & lt; TaskTimeLine & gt; GetTaskAndTimeLine {Task Timeline Task Time Line = New TaskTimeLine (); // Create new main object work TimeLine.scheduledDateTime = New list & lt; DateTime & gt; (); Object object object inside TaskTimeLine.task = db.Tasks.SingleOrDefault (d = & gt; D.ID == TaskID); Read the records to fill the single task object /// There are a lot of logic applied to add loads of date records in the list object. /// If I add a break point and can check the list, then I can see that all the date items are recoverable in the collection return (IQueryable & lt; TaskTimeLine & gt;) taskTimeLine; }  

The only reason is that I have so many weird places in places because it seemed that these programs help to compile. It currently does not compile, but I got it, but the actual error message fails to run, with the same error message.

Can anyone help in adding more useful titles for people in the future who are associated with such things.

taskTimeLine is a TaskTimeLine ; It also has a IQueryable & lt; Task timeline & gt; ?

Task Timeline Task Time Line = New Task Time Line (); // Create new main object .... Return (IQueryable & lt; TaskTimeLine & gt;) taskTimeLine;

IQueryable & lt; T & gt; Related to sources of data - not only the possible examples of data (possible exception: AsQueryable () ).

I should doubt your method GetTaskAndTimeLine TaskTimeLine ; And many more are inserted ...

  Public Terminal GetTaskAndTimeLine (Intel TaskId) {Task Timeline Task Time Line = New TaskTimeline (); // Create new key object ... [snip] return taskTimeLine; } ... task timeline task = task repository. GetTaskAndTimeLine (ID);  

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -