public async Task <IEnumerable <OutToolDTO> > GetToolAsync() { var tools = await _toolRepository.GetAll(); List <OutToolDTO> ret = new List <OutToolDTO>(); foreach (var t in tools) { ret.Add(new OutToolDTO() { Tool = t.Name }); } return(ret); }
public ToolsWindow(IUnityContainer container, IToolRepository db) { Container = container; _db = db; InitializeComponent(); this.PreviewKeyDown += new KeyEventHandler(HandleEsc); _toolDataContext = _db.GetAll(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { var tools = _db.GetAll(); if (!tools.Any()) { var result = MessageBox.Show("Czy dodać nowe urządzenie ?", "Wypożyczalnia", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { AddTool(); _toolDataContext = _db.GetAll(); } else { this.Close(); } } DataContext = _toolDataContext; _collectionViewSource = this.FindResource("ToolsListView") as CollectionViewSource; }