private void InitNetworkRepository()
 {
     _networkRepository = new NetworkRepository(new NoSqlTableInMemory <NetworkEntity>());
     _networkRepository.AddAsync(new Network {
         Id = "1", Ip = "127.0.0.1, 192.168.0, ::1", Name = "Local"
     }).Wait();
 }
        public async Task <IActionResult> AddNetwork(Network model)
        {
            try
            {
                if (string.IsNullOrEmpty(model.Name))
                {
                    return(JsonErrorValidationResult("Network name is required", "#network_name"));
                }

                if (string.IsNullOrEmpty(model.Ip))
                {
                    return(JsonErrorValidationResult("Ip range is required", "#network_ip"));
                }

                if (!model.IsValidIps())
                {
                    return(JsonErrorValidationResult("Wrong ip", "#network_ip"));
                }

                await _networkRepository.AddAsync(model);

                return(JsonRequestResult(".editItems", Url.Action("List")));
            }
            catch (Exception ex)
            {
                _log.Error(ex, context: model);
                return(JsonRequestResult(".editItems", Url.Action("List")));
            }
        }