api controller with actions using entity framework code example
Example 1: how to update record using entity framework 5
BY LOVE SINGH.
employeeDBEntities.tblEmployee.Attach(objTblEmployee);
employeeDBEntities.Entry(objTblEmployee).State = EntityState.Modified;
employeeDBEntities.SaveChanges();
Example 2: insert multiple records on the Database in Entity Framework Core
var dept1 = new Department() { Name = "Development" };
var dept2 = new Department() { Name = "HR" };
var dept3 = new Department() { Name = "Marketing" };
using (var context = new CompanyContext())
{
context.Department.AddRange(dept1, dept2, dept3);
context.SaveChanges();
}