public Person Update(Person person) { Person originPerson = Read(person.Id); if (originPerson == null) { return(null); } personListDbContext.Update(person); // Transfer the data //originCity.CountryName = country.CountryName; // Same command as the simplified version above int result = personListDbContext.SaveChanges(); if (result == 0) // Check if data is saved { return(null); } return(originPerson); }
public Country Update(Country country) { Country originCountry = Read(country.Id); if (originCountry == null) { return(null); } _personListDbContext.Update(country); // Transfer the data //originCity.CountryName = country.CountryName; // Same command as the simplified version above int result = _personListDbContext.SaveChanges(); if (result == 0) // Check if data is saved { return(null); } return(originCountry); }