Beispiel #1
0
        // GET: ClientController
        public IActionResult Index(string searchString)
        {
            var _clients = _clientRepo.GetClients();

            List <ViewClientViewModel> clients = _mapper.Map <IEnumerable <ViewClientViewModel> >(_clients).ToList();

            if (!String.IsNullOrEmpty(searchString))
            {
                clients = clients.Where(c => c.Name.ToLower().Contains(searchString.ToLower())).ToList();
            }
            return(View(clients));
        }
Beispiel #2
0
        public IActionResult DataTable()
        {
            var _vpns    = _vpnRepo.GetVpns();
            var _clients = _clientRepo.GetClients();

            List <ViewVpnViewModel> vpns = _mapper.Map <IEnumerable <ViewVpnViewModel> >(_vpns).ToList();

            foreach (var item in vpns)
            {
                item.ClientName = _clients.Where(c => c.Id == item.ClientId).FirstOrDefault().Name;
            }
            return(Json(vpns));
        }
Beispiel #3
0
        public HomeController(ILogger <HomeController> logger, IRepository repository, IClientRepo clientRepo)
        {
            _logger = logger;

            _model = new ViewModel {
                MyDetails = repository.GetAllData(), Clients = clientRepo.GetClients()
            };
        }
        public IActionResult Search(string searchString)
        {
            var _servers = _serverRepo.GetServers();
            var _clients = _clientRepo.GetClients();
            List <ViewServerViewModel> servers = _mapper.Map <IEnumerable <ViewServerViewModel> >(_servers).ToList();

            foreach (var item in servers)
            {
                item.ClientName = _clients.Where(c => c.Id == item.ClientId).FirstOrDefault().Name;
            }
            if (!String.IsNullOrEmpty(searchString))
            {
                servers = servers.Where(
                    s => s.Name.ToLower().Contains(searchString.ToLower()) ||
                    s.Username.ToLower().Contains(searchString.ToLower()) ||
                    s.ClientName.ToLower().Contains(searchString.ToLower()) ||
                    s.Categories.ToString().ToLower().Contains(searchString.ToLower()))
                          .ToList();
            }

            return(Json(servers));
        }
Beispiel #5
0
        public IActionResult Dashboard()
        {
            IEnumerable <ViewDashboardClientViewModel> _clients = _mapper.Map <IEnumerable <ViewDashboardClientViewModel> >(_clientRepo.GetClients());
            IEnumerable <ViewDashboardServerViewModel> _servers = _mapper.Map <IEnumerable <ViewDashboardServerViewModel> >(_serverRepo.GetServers());
            IEnumerable <ViewDashboardVpnViewModel>    _vpns    = _mapper.Map <IEnumerable <ViewDashboardVpnViewModel> >(_vpnRepo.GetVpns());

            var dashboardViewModel = new ViewDashboardViewModel
            {
                TotalClients = _clients.Count(),
                TotalServers = _servers.Count(),
                TotalVpns    = _vpns.Count()
            };

            foreach (var item in _servers)
            {
                item.ClientName = _clients.Where(c => c.Id == item.ClientId).FirstOrDefault().Name;
            }

            foreach (var item in _vpns)
            {
                item.ClientName = _clients.Where(c => c.Id == item.ClientId).FirstOrDefault().Name;
            }
            dashboardViewModel.Clients = _clients.Take(5);
            dashboardViewModel.Servers = _servers.Take(5);
            dashboardViewModel.Vpns    = _vpns.Take(5);
            return(View(dashboardViewModel));
        }
Beispiel #6
0
 //public ActionResult Get()
 public IEnumerable <Clients> Get()
 {
     return(_repository.GetClients());
 }
Beispiel #7
0
 public ActionResult <IEnumerable <ClientViewModel> > GetAllClients()
 {
     return(_clientRepo.GetClients().ToList());
 }