Ejemplo 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;
         }
     }
 }
Ejemplo n.º 2
0
 public void Reload()
 {
     Barracks = BarrackService.GetAll();
     NotifyOfPropertyChange(() => Barracks);
 }