//Opens an existing product so its details can be modified. private void btnModifyProduct_Click(object sender, EventArgs e) { clsGuitar lcGuitar = (clsGuitar)lstProducts.SelectedItem; frmGuitar.DispatchGuitarForm(lcGuitar); if (lcGuitar.serial_no != 0) // not cancelled? { UpdateDisplay(); } }
internal async static Task <string> DeleteProductAsync(clsGuitar prGuitar) { using (HttpClient lcHttpClient = new HttpClient()) { HttpResponseMessage lcRespMessage = await lcHttpClient.DeleteAsync ($"http://localhost:60064/api/guitarhub/DeleteProduct?serial_no={prGuitar.serial_no}"); return(await lcRespMessage.Content.ReadAsStringAsync()); } }
//Opens either a new Acoustic or Electric guitar form so it can be added into lstProducts private void btnAddProduct_Click(object sender, EventArgs e) { string lcChoice = cbType.Text; clsGuitar lcGuitar = clsGuitar.NewGuitar(lcChoice); frmGuitar.DispatchGuitarForm(lcGuitar); if (lcGuitar.serial_no != 0) // not cancelled? { UpdateDisplay(); } }
public void SetDetails(clsGuitar prGuitar) { _Guitar = prGuitar; updateForm(); ShowDialog(); }
public static void DispatchGuitarForm(clsGuitar prGuitar) { _GuitarForm[prGuitar.guitar_type].DynamicInvoke(prGuitar); }
internal async static Task <string> UpdateGuitarAsync(clsGuitar prGuitar) { return(await InsertOrUpdateAsync(prGuitar, "http://localhost:60064/api/guitarhub/PutGuitar", "PUT")); }