Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace EntityFrameword
- {
- class Program
- {
- static void Main(string[] args)
- {
- var context = new SoftuniContext();
- var newAddress = new Address()
- {
- AddressText = "Vitoshka 15",
- TownID = 4,
- };
- context.Addresses.Add(newAddress);
- var person = context.Employees;
- foreach (var per in person.Where(a => a.LastName == "Nakov"))
- {
- per.AddressID = newAddress.AddressID;
- }
- context.SaveChanges();
- var adresses = context.Addresses;
- foreach (var adr in adresses.OrderByDescending(a => a.AddressText))
- {
- Console.WriteLine(adr);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement