public IActionResult Update([FromBody] PropertyChangeModel changeModel) { if (_context.UpdateProperty(changeModel)) { return(Ok(changeModel.Property)); } return(BadRequest()); }
public bool UpdateProperty(PropertyChangeModel changeModel) { if (changeModel.HasIdChanged) { _context.Delete(new Property { Id = changeModel.OriginalId }); _context.Add(changeModel.Property); return(true); } return(_context.Update(changeModel.Property)); }