Exemplo n.º 1
0
 public void Add()
 {
     if (!IsEdit)
     {
         SelectedEmployees = ActualEmployees.ToList();
         string x = BarrackService.Add(Name, Capacity);
         if (x == null)
         {
             EmployeeService.AddEmployeesToBarrack(SelectedEmployees, BarrackService.GetAll().Last().Id);
             TryClose();
         }
         else
         {
             Error = x;
         }
     }
     else
     {
         toEdit.Name       = Name;
         toEdit.Capacity   = Capacity;
         SelectedEmployees = ActualEmployees.ToList();
         string x = BarrackService.Edit(toEdit);
         if (x == null)
         {
             EmployeeService.AddEmployeesToBarrack(SelectedEmployees, toEdit.Id);
             TryClose();
         }
         else
         {
             Error = x;
         }
     }
 }
Exemplo n.º 2
0
        public void Delete(BarrackDTO barrack)
        {
            IWindowManager manager             = new WindowManager();
            DeleteConfirmationViewModel modify = new DeleteConfirmationViewModel();
            bool?showDialogResult = manager.ShowDialog(modify, null, null);

            if (showDialogResult != null && showDialogResult == true)
            {
                BarrackService.Delete(barrack);
            }
            Reload();
        }
Exemplo n.º 3
0
 public void Reload()
 {
     Barracks = BarrackService.GetAll();
     NotifyOfPropertyChange(() => Barracks);
 }