private async Task UpdateMethodOfPayment() { if (ValidateInputs()) { MethodOfPaymentEditVM methodOfPaymentEditVM = new MethodOfPaymentEditVM() { Id = methodOfPayment.Id, Method = TbMethod.Text }; ls.LblLoading.Text = "Editing"; ls.Show(); bool success = await methodOfPaymentApi.UpdateMethodOfPayment(methodOfPaymentEditVM); ls.Close(); if (success) { Close(); } else { MessageBox.Show("Fail!"); } } else { MessageBox.Show("All input fields are required!"); } }
public bool EditMethodOfPayment(MethodOfPaymentEditVM methodOfPaymentEditVM) { MethodOfPayment methodOfPayment = unitOfWork.MethodsOfPayment.Get(methodOfPaymentEditVM.Id); methodOfPayment.Method = methodOfPaymentEditVM.Method; int success = unitOfWork.Complete(); return(success > 0); }
public async Task <bool> UpdateMethodOfPayment(MethodOfPaymentEditVM methodOfPaymentEditVM) { StringContent content = GetStringContent(methodOfPaymentEditVM); HttpClient request = new HttpClient(); HttpResponseMessage response = await request.PutAsync($"{ API_URL }/EditMethodOfPayment", content); if (response.IsSuccessStatusCode) { bool result = await response.Content.ReadAsAsync <bool>(); return(result); } return(false); }