public void Add() { if (!IsEdit) { string x = TeamTypeService.Add(Type); if (x == null) { TryClose(); } else { Error = x; } } else { toEdit.Name = Type; string x = TeamTypeService.Edit(toEdit); if (x == null) { TryClose(); } else { Error = x; } } }
public AddTeamViewModel(TeamDTO team) { IsEdit = true; ButtonLabel = "Edit"; TeamTypes = TeamTypeService.GetAllBindableCollection(); AvailableEmployees = new BindableCollection <EmployeeDTO>(EmployeeService.GetAll().Where(x => x.TeamId == null).ToList()); ActualEmployees = new BindableCollection <EmployeeDTO>(EmployeeService.GetAll().Where(x => x.TeamId == team.Id).ToList()); int i = 0; while (ActualType == null) { if (TeamTypes[i].Id == team.TeamTypeId) { ActualType = i; break; } else { i++; } } this.toEdit = team; Name = toEdit.Name; Responsibilities = toEdit.Responsibilities; }
public AddTeamViewModel() { IsEdit = false; ButtonLabel = "Add"; TeamTypes = TeamTypeService.GetAllBindableCollection(); AvailableEmployees = new BindableCollection <EmployeeDTO>(EmployeeService.GetAll().Where(x => x.TeamId == null && x.IsSelected == false).ToList()); ActualEmployees = new BindableCollection <EmployeeDTO>(); }
public void Delete(TeamTypeDTO teamType) { IWindowManager manager = new WindowManager(); DeleteConfirmationViewModel modify = new DeleteConfirmationViewModel(); bool?showDialogResult = manager.ShowDialog(modify, null, null); if (showDialogResult != null && showDialogResult == true) { TeamTypeService.Delete(teamType); } Reload(); }
public void Reload() { TeamTypes = TeamTypeService.GetAll(); NotifyOfPropertyChange(() => TeamTypes); }