score:1
Accepted answer
public list<task> gettasks(int empid)
{
return ttask
.where(t => ttaskview.where(v => v.id == empid).select(v => v.taskid).contains(t.id))
.select(t => new task()
{
id = t.id,
actionableid = t.actionableid,
statusid = t.statusid,
typeid = t.typeid,
description = t.description
}).tolist();
}
score:1
var query =
from tt in tasktable
join tvt in taskviewtable on tt.id equals tvt.taskid into xs
where xs.any(z => z.employeeid == empid)
select tt;
Source: stackoverflow.com
Related Query
- LINQ Method that returns set based on filtered sub-set
- Sending items in a LINQ sequence to a method that returns void
- c# Linq method is not following one of my conditions that I set
- C# LINQ - Return a typed filtered list based on a child property that is inside another list
- Is it possible to add linq to the end of a method that returns rows from a database? I just want to tack on an ORDER BY clause
- Linq query that returns entire rows based on a distinct column value
- How to return anonymous type from c# method that uses LINQ to SQL
- Using IDisposable object in method that returns IEnumerable<T>
- LINQ method to sort a list based on a bigger list
- How can I set properties on all items from a linq query with values from another object that is also pulled from a query?
- Linq to Sql - Set connection string dynamically based on environment variable
- Is there a LINQ extension or (a sensible/efficient set of LINQ entensions) that determine whether a collection has at least 'x' elements?
- Linq Query Returns Incorrect Result Set
- Is it possible to ignore a list item using the Skip method of the LINQ then apply skip on the list without losing that item?
- Linq: Method that returns first instance with given type
- How do I make a streaming LINQ expression that delivers the filtered out items as well as the filtered items?
- Custom jQuery Selector That Returns Selected Element Properties Like LINQ
- SQL > Linq to Sql, SQL Query works, Linq to SQL returns empty data set
- How do I setup a mock that dynamically returns results based on a parameter's value?
- Building a common set of methods that can operate on any linq table
- Linq expression to return the first overloaded method that takes 1 string parameter
- Is there a Linq method that does .SelectMany(x => x)?
- Is there any elegant way in LINQ to bucket a collection into a set of lists based on a property
- Moving a LINQ sub query to an extension method fails at runtime
- Pass a property of a Linq entity in a method to set and get result
- Inner method in Linq query that return IQueryable
- Terms might be wrong: LINQ Select that will return entire intermediate object based on child subtype
- Is there a Linq method to tell that A is the subset of B?
- LINQ Query - Selecting a key based upon the value having a property that matches a string?
- Calling method with linq syntax based on condition
More Query from same tag
- Filtering in MVC Razor using LINQ
- Populating a highchart graph from a linq query
- Have a Query want it in LINQ(Inner Join)
- LINQ distinct to @Html.DropDownList
- Filter data from DataTable
- Using Linq to Select properties of class to return IEnumerable<T>
- Get all values of List with its nested list properties
- Dynamic where clause for joined System.Data.DataTable in Linq C#
- Sort a list by alpha values first, numeric values next
- join expression to linq query
- C# Array.Contains () compilation error
- Compare array with TextBox to check for repeated values in database
- C# Linq Lamba elements count
- What is the Big O of linq .where?
- Error with multiple nested Any() in linq to SQL in EF
- C# LINQ Custom Order By
- Aggregating data from two collections
- How to add XComment on same line as an XElement?
- Get sub objects of sub objects collections
- LINQ to Datatable - How to add an if condition in linq query where clause?
- IEqualityComparer with Linq to XML and Distinct() is not executed in code?
- Linq - calculate multiple averages in one query
- How can I model this class in a database?
- How do I trim DB field spaces querying DB with Entity Framework?
- How to search from a list inside a dictionary<string, List<string>>
- Search query using .Contains() for parameters that combine two columns
- How can I specify an index hint in Entity Framework?
- Join table on multiple conditions with LINQ, always show all results of primary key and coalesce nulls
- Very confused about how to Group by in LINQ, and even more confused about HAVING
- Case insensitive XML parser in c#