public int DeleteCatatan(Catatan catatanInstance) { var id = catatanInstance.Id; if (id != 0) { lock (collisionLock) { database.Delete <Catatan>(id); } } this.Catatans.Remove(catatanInstance); return(id); }
public int SaveCatatan(Catatan catatanInstance) { lock (collisionLock) { if (catatanInstance.Id != 0) { database.Update(catatanInstance); return(catatanInstance.Id); } else { database.Insert(catatanInstance); return(catatanInstance.Id); } } }