Exemplo n.º 1
0
        public HttpResponseMessage DeleteIndividual(Individual individual)
        {
            _individualService.Delete(individual);

            var response = new
            {
                id = individual.Id
            };

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            // Check if any data is selected for delete
            if (CurrentIndividual == null)
            {
                MainWindow.ErrorMessage = ("Morate odabrati radnika za brisanje!");
                return;
            }

            // Show blur effects
            SirmiumERPVisualEffects.AddEffectOnDialogShow(this);

            // Create confirmation window
            DeleteConfirmation deleteConfirmationForm = new DeleteConfirmation("radnika", CurrentIndividual.Name);

            var showDialog = deleteConfirmationForm.ShowDialog();

            if (showDialog != null && showDialog.Value)
            {
                // Delete business partner
                IndividualResponse response = individualService.Delete(CurrentIndividual.Id);

                // Display data and notifications
                if (response.Success)
                {
                    MainWindow.SuccessMessage = ("Podaci su uspešno obrisani!");
                    Thread displayThread = new Thread(() => PopulateData());
                    displayThread.IsBackground = true;
                    displayThread.Start();
                }
                else
                {
                    MainWindow.ErrorMessage = (response.Message);
                }
            }

            // Remove blur effects
            SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this);

            dgIndividuals.Focus();
        }