Beispiel #1
0
        private void dgSastojci_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 6)
            {
                HttpResponseMessage response = _sastojci.DeleteCustomRouteResponse(WebApiRoutes.DELETE_VRSTE_SASTOJAKA,
                                                                                   (dgSastojci.Rows[e.RowIndex].Cells[0].Value).ToString());

                if (response.IsSuccessStatusCode)
                {
                    RefreshState();
                }
                else
                {
                    MessageBox.Show("Akcija nije moguca: " + response.StatusCode);
                }
            }
        }
Beispiel #2
0
        public void DeleteClicked(object sender, EventArgs e)
        {
            var item = (Xamarin.Forms.Button)sender;
            // KorpaMobileVm listitem = (from itm in source.Items where itm.KorpaId == Convert.ToInt64(item.CommandParameter.ToString()) select itm).FirstOrDefault<KorpaMobileVm>();
            int           korpaFrom = Convert.ToInt32(item.CommandParameter.ToString());
            KorpaMobileVm listitem  = source.Items.FirstOrDefault(x => x.StavkaId == korpaFrom);

            source.Items.Remove(listitem);

            var response = service.DeleteCustomRouteResponse(WebApiRoutes.DELETE_ITEM_KORPA, parameters: "/" + listitem.KorpaId + "/stavke/" + listitem.StavkaId);

            if (!response.IsSuccessStatusCode)
            {
                DisplayAlert("Upozorenje!", "Nije moguce obrisati stavku", "OK");
            }
            else
            {
                if (source.Items != null)
                {
                    lblUkupno.Text = "Ukupna cijena: " + getSumZarada(source.Items).ToString() + " KM";
                }
            }
        }