Пример #1
0
        private void dgNarudzbe_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string narudzbaId = dgNarudzbe.Rows[e.RowIndex].Cells[0].Value + "";

            if (e.ColumnIndex == 6)
            {
                Kupon frm = new Kupon(Convert.ToInt32(narudzbaId));
                frm.ShowDialog();
            }
            else
            {
                if (e.ColumnIndex == 7)
                {
                    HttpResponseMessage korpaResponse =
                        _service.GetCustomRouteResponse(WebApiRoutes.GET_KORISNICI_KORPA, narudzbaId);

                    KorpaModel korpa = korpaResponse.Content.ReadAsAsync <KorpaModel>().Result;

                    HttpResponseMessage response =
                        _service.PutCustomRouteResponse(WebApiRoutes.PUT_KORISNICI_POVJERLJIVOST, new PromjenaPovjerljivostiVm {
                        KorisnikId = korpa.KorisnikId,
                        KorpaId    = korpa.Id,
                        Status     = false
                    });

                    if (response.IsSuccessStatusCode)
                    {
                        RefreshState();
                    }
                }
            }
        }
Пример #2
0
        private void KorisniciGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            HttpResponseMessage response =
                KorisniciService.PutCustomRouteResponse(WebApiRoutes.PUT_KORISNICI_POVJERLJIVOST,
                                                        new PromjenaPovjerljivostiVm {
                KorisnikId = Convert.ToInt32(KorisniciGrid.Rows[e.RowIndex].Cells[0].Value.ToString()), Status = true
            });

            if (response.IsSuccessStatusCode)
            {
                BindGrid();
            }
            else
            {
                MessageBox.Show("Nije uspjeli oznaciti korisnika kao povjerljivog.");
            }
        }