public MainWindowViewModel(ServerViewModelFactory serverViewModelFactory, RoutingState routingState) { _serverViewModelFactory = serverViewModelFactory; Router = routingState; Activator = new ViewModelActivator(); this.WhenActivated(async(CompositeDisposable disposables) => { await OnActivationAsync(); Disposable .Create(() => { /* handle deactivation */ }) .DisposeWith(disposables); }); }
public async Task <IActionResult> GetServers() { var servers = await _context.Servers .Include(c => c.Country) .Include(c => c.RedirectorServer) .ThenInclude(c => c.Country) .Include(c => c.TrafficServer) .ThenInclude(c => c.Country) .Include(c => c.ServerProtocals) .Where(c => c.IsPublic).ToListAsync(); if (!servers.Any()) { return(NotFound()); } return(Ok(servers.Select(c => ServerViewModelFactory.Create(c)))); }