コード例 #1
0
ファイル: WorkersWindow.xaml.cs プロジェクト: Ksisovec/Diplom
        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();
        }
コード例 #2
0
        public async Task <WorkerDTO> DeleteAsync(long Id)
        {
            Worker result = await _workerRepository.Delete(Id);

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

            return(worker);
        }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
ファイル: WorkerService.cs プロジェクト: anaskret/CarRent
 public string DeleteWorker(int id)
 {
     _workerRepository.Delete(id);
     return($"Worker with id {id} was succesfuly deleted");
 }
コード例 #5
0
 public IActionResult Delete(string alias)
 {
     //megkapjuk a törlendő dolgozó aliasát
     repo.Delete(alias);
     return(RedirectToAction("Index"));
 }
コード例 #6
0
 public void Delete(int id)
 {
     _repository.Delete(id);
 }
コード例 #7
0
 public void Delete(int id)
 {
     _workerRepository.Delete(id);
 }