Exemplo n.º 1
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            if (workerListView.SelectedItem == null)
            {
                MessageBox.Show("errror");
                return;
            }
            Items it = (Items)workerListView.SelectedItem;

            workerRepositoty.Delete(it.wrk);
            workerRepositoty.DeleteFromCache(it.wrk.ID);

            IEnumerable <Worker> workers;

            workers = workerRepositoty.GetListFromCache();
            foreach (Worker wr in workers)
            {
                DateTime d2 = contractRepositoty.Get(p => p.WorkerId == wr.ID).Last().EndDate;
                TimeSpan d3 = d2 - DateTime.Now;
                workerListView.Items.Add(new Items
                {
                    wrk  = wr,
                    dep  = departamentRepositoty.GetByIdFromCahce(wr.DepartamentID),
                    date = d3
                });
            }
            workerListView.Items.Refresh();
        }
Exemplo n.º 2
0
        public async Task <WorkerDTO> DeleteAsync(long Id)
        {
            Worker result = await _workerRepository.Delete(Id);

            var worker = _mapper.Map <Worker, WorkerDTO>(result);

            return(worker);
        }
        private void DeleteWorkerButton_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult dialogResult = MessageBox.Show($"Ви точно хочете видалити {(WorkersDataGrid.SelectedItem as Worker).FullName}?", "Видалити працівника", MessageBoxButton.YesNo);

            if (dialogResult == MessageBoxResult.Yes)
            {
                _workerRepository.Delete((WorkersDataGrid.SelectedItem as Worker).WorkerId);
                UpdateData();
            }
        }
Exemplo n.º 4
0
 public string DeleteWorker(int id)
 {
     _workerRepository.Delete(id);
     return($"Worker with id {id} was succesfuly deleted");
 }
Exemplo n.º 5
0
 public IActionResult Delete(string alias)
 {
     //megkapjuk a törlendő dolgozó aliasát
     repo.Delete(alias);
     return(RedirectToAction("Index"));
 }
Exemplo n.º 6
0
 public void Delete(int id)
 {
     _repository.Delete(id);
 }
Exemplo n.º 7
0
 public void Delete(int id)
 {
     _workerRepository.Delete(id);
 }