public IResult <bool> DeleteItem(long id) { IResult <bool> res = new Result <bool>(); try { ItemServiceClient client = this.serviceProxy as ItemServiceClient; ResponseOfTypeboolean resp = client.DeleteItem(id); client.Close(); if (resp.IsSuccessful) { res.IsSuccessful = true; res.Message = ""; res.Method = resp.Method; res.Result = resp.Result; } else { res.IsSuccessful = false; res.Message = resp.Message; res.Method = resp.Method; res.Result = false; } } catch (Exception ex) { res.IsSuccessful = false; res.Message = ex.Message; res.Method = "DeleteItem"; res.Result = false; } return(res); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { if (!IsItemSelected()) { return; } itemService.DeleteItem(selectedItem.Id, user.LoginToken.SecureToken); ResetForm(); UpdateDataGrid(); }