static void Insert(IContactRepo repo) { var contact = new Contact { FirstName = "Viktor", LastName = "Prykhidko", Email = "*****@*****.**", Company = "xyz", Title = "Dev", Addresses = { new Address { AddressType = "Home", City = "Kiev", ContactId = 1, IsDeleted = false, PostalCode = "32057", StateId = 1, StreetAddress = "Khreshchatyk" } } }; repo.Save(contact); Debug.Assert(contact.Id != 0); Console.WriteLine(contact.Id); }
static void Update(IContactRepo repo) { var c = repo.GetFullContact(1); c.FirstName = "Edited"; c.Addresses[0].StreetAddress = "Edited"; repo.Save(c); c = repo.GetFullContact(1); Debug.Assert(c.FirstName == "Edited"); Debug.Assert(c.Addresses[0].StreetAddress == "Edited"); Console.WriteLine(c.Serialize()); }
public IActionResult Update(Contact contact) { Console.WriteLine($"Update contact {contact.Name}"); _repo.Save(contact); return(NoContent()); }