i have one json file and i deserialize this one in c# console entity frame work now i want to show data that was stored in the file to my table in sql server this is my code i tried to Equalize the fields in my file to my table fields what should i do next ?
using (var context = new UNIEntities1())
{
var majorId = context.Major.Where(e =>e.MajorName == dto.Major).Select(e => e.IdMajor);
return new student1()
{
StudentName = dto.StudentName,
Age = dto.Age,
Address = dto.Address,
Major = majorId,
PhoneNumber = dto.PhoneNumber
};
}
this is the code for deserialization
public static StudentDto Deserialize()
{
var Student = JsonConvert.DeserializeObject<StudentDto>(File.ReadAllText(@"unii.json"));
return Student;
}
this part works but i do not Know how to save this data to my data base and then show it ?