Example #1
0
        public async Task <IActionResult> StartWhoisAsync(WhoisViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("Whois", model));
            }

            if (_dbStatus.Connected)
            {
                var entry = await _whois
                            .Query(a => a.Hostname == model.Hostname)
                            .Select(a => new { a.Updated, a.Result })
                            .SingleOrDefaultAsync();

                if (entry != null &&
                    DateTime.UtcNow.Subtract(entry.Updated).TotalDays < WhoisMinUpdateDays)
                {
                    model.Updated = entry.Updated;
                    model.Result  = entry.Result;
                    model.Id      = null;
                }

                model.History = await GetLastWhoisEntriesAsync();
            }

            if (!model.Updated.HasValue)
            {
                var dtos = new List <WhoisDto> {
                    new WhoisDto(model.Hostname)
                };
                model.Id = _whoisQueue.Add(dtos);
            }

            return(View("Whois", model));
        }
Example #2
0
        public WhoisView(int tabId)
        {
            InitializeComponent();

            _viewModel = new WhoisViewModel(tabId);

            DataContext = _viewModel;
        }
Example #3
0
        public WhoisView(int tabId, string domain = null)
        {
            InitializeComponent();

            _viewModel = new WhoisViewModel(tabId, domain);

            DataContext = _viewModel;
        }
Example #4
0
        public WhoisView(int tabId, string domain = null)
        {
            InitializeComponent();

            _viewModel = new WhoisViewModel(DialogCoordinator.Instance, tabId, domain);

            DataContext = _viewModel;
        }
Example #5
0
        public async Task <IActionResult> WhoisAsync()
        {
            var model = new WhoisViewModel();

            if (_dbStatus.Connected)
            {
                model.History = await GetLastWhoisEntriesAsync();
            }

            return(View(model));
        }