private void btnUpdate_Click(object sender, RoutedEventArgs e) { if (!IsItemSelected()) { return; } itemService.UpdateItem(selectedItem.Id, user.LoginToken.SecureToken, txtName.Text, txtDescribe.Text, selectedItem.Category.Id); UpdateDataGrid(); }
public IResult <long> UpdateItem(IItem bo) { IResult <long> res = new Result <long>(); Item dto = new Item(); dto.ID = bo.ID; dto.Name = bo.Name; dto.ParameterA = bo.ParameterA; dto.ParameterB = bo.ParameterB; dto.Product = bo.Product; try { ItemServiceClient client = this.serviceProxy as ItemServiceClient; ResponseOfTypelong resp = client.UpdateItem(dto); 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 = 0; } } catch (Exception ex) { res.IsSuccessful = false; res.Message = ex.Message; res.Method = "UpdateItem"; res.Result = 0; } return(res); }