Пример #1
0
        //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();
            }
        }
Пример #2
0
        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());
            }
        }
Пример #3
0
        //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();
            }
        }
Пример #4
0
 public void SetDetails(clsGuitar prGuitar)
 {
     _Guitar = prGuitar;
     updateForm();
     ShowDialog();
 }
Пример #5
0
 public static void DispatchGuitarForm(clsGuitar prGuitar)
 {
     _GuitarForm[prGuitar.guitar_type].DynamicInvoke(prGuitar);
 }
Пример #6
0
 internal async static Task <string> UpdateGuitarAsync(clsGuitar prGuitar)
 {
     return(await InsertOrUpdateAsync(prGuitar, "http://localhost:60064/api/guitarhub/PutGuitar", "PUT"));
 }