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