Esempio n. 1
0
        /// <summary>
        /// Adds new wireless sensor network to account
        /// </summary>
        /// <param name="Network">model of the newtork to be created</param>
        /// <returns>unique identifier for created network</returns>
        public async Task <long> CreateNetwork(CreateNetwork Network)
        {
            //Create a nework using the notifEye DB
            var network = await _networkClient.CreateNetwork(Network.Name);

            //prepare the networklocation model.
            var netLocation = _mapper.Map <NetworkLocation>(Network);

            netLocation.CSNetID = network.NetworkID;

            //create a Networklocation in DB
            await _networkLocationClient.CreateNetworkLocation(netLocation);

            return(network.NetworkID);
        }
Esempio n. 2
0
        public async Task <object> POST(CreateNetwork request)
        {
            var response   = new BaseResponse();
            var crtNetwork = new ServiceModel.Network()
            {
                id          = request.id,
                nameNetwork = request.nameNetwork
            };
            var result = await _netWorkService.Create(crtNetwork);

            response.Results = result;
            if ((bool)response.Results == true)
            {
                response.Message = "Created network successfully";
            }
            else
            {
                response.Message = "Created network failed";
            }
            return(response);
        }
 public async Task <IHttpActionResult> CreateNetwork([FromBody] CreateNetwork Network)
 {
     return(Ok(await _networkApplicationService.CreateNetwork(Network)));
 }