Example #1
0
        public async Task <IActionResult> Logout([FromBody] IpContract contract)
        {
            try
            {
                await _manager.Neo4J.DeleteHost(contract.ip);

                return(Ok(_response.SetStatus(true, "Ok")));
            }
            catch (Exception e)
            {
                return(BadRequest(_response.SetStatus(false, $"NOK. {e.Message}")));
            }
        }
Example #2
0
        public async Task <IActionResult> Login([FromBody] IpContract contract)
        {
            try
            {
                if (!await _manager.PushNewHost(contract.ip))
                {
                    return(Unauthorized(_response.SetStatus(false, "Ok. Log In Error")));
                }

                await _manager.UpdateRedisStorage();

                return(Ok(_response.SetStatus(true, "OK")));
            }
            catch (Exception e)
            {
                return(BadRequest(_response.SetStatus(false, $"NOK. {e.Message}")));
            }
        }
Example #3
0
        public IpViewModel(IpContract dataSource)
        {
            Ensure.NotNull(dataSource, nameof(dataSource));

            _dataSource = dataSource;
        }