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
- Most performant way to filter a huge List in C#?
- .Net Core API & Automapper with many to many relationship mapping
- Extending Func to accept array parameter in C#
- Method call in LINQ column
- Complex SQL Query for a custom role provider
- Adding a range of values in to a List using LinQ
- Compare the item from one list object with another item from another list object
- LINQ to XML: parsing XML file which one of nodes presents type of another node
- LINQ Select from sub-list
- Group by string occurence using linq
- Dictionary of dictionaries
- Nested Linq Queries doesn't behave as expected
- Encrypt column data with LINQ
- LINQ to SQL: subfilter in where conditions
- Problem with dynamic query building for Entity Framework Core 3.1.6
- System.Linq.Queryable.FirstOrDefault<TSource>(...) returns null
- How merge two sequences into one?
- LINQ Concat to stack?
- JOIN for Membership table
- Entity Framework Core Linq query returning ids which do not exist in database
- Convert IOrderedEnumerable to XElement
- How to get Average of grouped results in Linq query
- Assign same ranks to same scores in LinQ
- Complex Xml namespaces in c#
- LINQ: adding where clause only when a value is not null
- Joining tables in EF Core Linq Query
- Wildcard search
- Linq to SQL grouping with embedded lists causes too many queries
- Is it necessary that every table in SQL Server CE must have a primary key?
- Dynamic Linq with date fields