public void PostToAPI() { isExecute = false; if (foodVmObj != null) { Task.Run(() => { AccessAPI.Post(foodVmObj); SetCollection(); MessageBox.Show($"{foodVmObj.Name} Was Posted Successfully", "Success", MessageBoxButton.OK, MessageBoxImage.Exclamation); }); } else { MessageBox.Show("Operation Failed", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } isExecute = true; }