Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

update multiple records with entity framework

using (var dbcontext = new MyModel()){
   var matchedRecords = dbcontext.DummyTable.Where(e => e.code.Equals(entry.code) && e.isValid.Equals(true)).ToList();
   matchedRecords.ForEach(e => e.isValid = false);
   dbcontext.SaveChanges();
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: get index c# 
Csharp :: c# string from b64 
Csharp :: array sorting c# 
Csharp :: streamwriter c# 
Csharp :: count number of properties on an object C# 
Csharp :: c# nullable string 
Csharp :: c# getting user input 
Csharp :: unit test c# exception thrown 
Csharp :: Squares of a Sorted Array 
Csharp :: float and int need help 
Csharp :: c# decimal vs double 
Csharp :: Convert DataTable to Dictionary in C# 
Csharp :: length of a string c# 
Csharp :: c# delegate 
Csharp :: c# radio button checked 
Csharp :: c# function return 
Csharp :: check two lists are equal c# 
Csharp :: minimize window windows forms application c# 
Csharp :: c# list foreach 
Csharp :: c# windows forms open directory in explorer 
Csharp :: c# excel workbook 
Csharp :: convert-integer-to-binary-in-c-sharp 
Csharp :: c# how to set string list 
Csharp :: how to filter a datatable in c# 
Csharp :: c# list.foreach 
Csharp :: how to add a force to an object unity 
Csharp :: c# lists 
Csharp :: wpf textblock line break code behind 
Csharp :: datatable iqueryable c# linq 
Csharp :: Raycasting to find mouseclick on Object in unity 2d games 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =