As brought forwarded from the previous question here.
I am using the DTO method to inner join data. Now is it possible to update data at my joined result? How the data will be updated back to the origin table where it should be possible be?
Requirement:
- I am using Entity Framework, C#, ASP.NET Web API
- I am using SQL Server
Currently I successfully joined employee and department table based on their ID. I joined employee and workingshifts based on their shift_id.
The inner join query was here:
from e in DSE.employees
join d in DSE.departments on e.department_id equals d.department_id
join ws in DSE.workingshifts on e.shift_id equals ws.shift_id
So the data are here:
[{"FirstName":"gg","LastName":"wp","Gender":"NoGender","Salary":8,"Department_id":1,
"Department_Name":"RND","Shift_id":"B","Duration":"afternoon"}]
Now I would like to update the information as follows:
FirstName: good game
LastName: well played
Gender: IGender
Salary: 8888
Shift_id: A
Duration: Morning
May I know that what code that should be done in my C# and Linq? Will it update back to my database tables? Moreover, I heard about this solution by using SQL stored procedure, you may show me this approach as well