public void UpdateTenant(Tenant toUpdate) { using (var ctx = new Landlord.Data.ApplicationDbContext()) { ctx.Entry(toUpdate).State = EntityState.Modified; ctx.SaveChanges(); } }
public void UpdateProperty(Property toUpdate) { Result LocationData = GetLocationData(toUpdate.Address); using (var ctx = new Landlord.Data.ApplicationDbContext()) { toUpdate.Latitude = LocationData.geometry.location.lat.ToString(); toUpdate.Longitude = LocationData.geometry.location.lng.ToString(); ctx.Entry(toUpdate).State = EntityState.Modified; ctx.SaveChanges(); } }