score:2
Accepted answer
var selectedvalues = model
.questions
.select(q => q.selectedanswer);
foreach (var x in evalvm
.questions
.selectmany(q => q.answers)
.where(answer => selectedvalues.contains(answer.id.tostring())))
x.isselected = "checked";
Source: stackoverflow.com
Related Query
- How to update my model code using LINQ
- how to update the multiple rows at a time using linq to sql?
- How to update value in a List using LINQ
- How to update an element with a List using LINQ and C#
- How to update a single item of liist of objects using LINQ in C#
- How can I write the following code more elegantly using LINQ query syntax?
- How can I code an outer join using LINQ and EF6?
- How do I use CURRENT_TIMESTAMP in a LINQ update statement using Entity Framework Core?
- How Update a node attribute in xml using Linq query?
- How to perform an update using Linq or Lambda?(C#, Asp.net,Linq , Lambda)
- How to flatten a multi level XML into a single level XML using c# code LINQ
- How to write this code using the Linq Extension Method-Syntax?
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- How to write a DISTINCT or GROUPBY LINQ statement using a strongly typed model in MVC
- How to update a table in database using LINQ in F#?
- How to simplify the code Using LINQ
- How to update a list based on more than one Condition using LINQ C#
- Using only Linq or Lambda, how do I combine both pieces of code to return List<Entity> e?
- How to handle nulls in this LINQ Code using a possible null List?
- How to update a single column in single row in a datatable using LinQ
- How to update the data in database using linq
- How to Update previous row column based on the current row column data using LinQ
- How could I update the database using LINQ
- c# how to update model based on other model with Linq
- How to reinsert data from one table onto itself using LINQ in code migration?
- How to update a database using LINQ to SQL?
- how to insert data in 1 table and update another table in a sql database using linq
- How to update an item in a List using LINQ
- How to update anonymous objects property using LINQ and Contains
- How to update node value in a linkedlist using linq
More Query from same tag
- Dynamic Linq to Entity Framework
- Query SortedList<Object1,Object2> with Linq
- How do I get Distinct() to work with a collection of custom objects
- Linq to entities with EF in an specific relational model
- How to query this in SQL Server?
- How to tell Entity Framework to not include a nested object?
- How do I pivot dynamically in Linq using this example
- Find elements from collection contains names from string array
- How to compare 2 comma seperated string values and update in existing list at same position?
- Force Take() to get less than count if there are no enough elements
- Using LINQ Contains - How to make sure a specific character does not follow
- Using LINQ to get a diff between a list and insert it back in between?
- Linq to Moq - Nullable Types
- Start reading data from a specific row of excel using Linq in C#
- Complex Linq c# query
- Update only a single item in linq
- Comparison : LINQ vs LAMBDA Expression
- How do I pass a Linq query to a method?
- How to check a string contains another string
- Can I build Tuples from IEnumerables using Linq?
- Convert VB.NET Linq to C# Linq code
- Linq projection that flattens a list into a deliminated string
- C# Linq that includes sorting and grouping
- Multiple Table Join in Linq C# Dynamically
- counting Movie by grouping alphabetically using linq
- Nested foreaches into a chained linq expression
- C# Polymorphism with generic type constraints
- Performance LINQ async await
- Linq - Find max value from a nvarchar type column in SQL Server
- Getting "String or binary data would be truncated", when retrieving data via a LINQ query which uses CONTAINS