Ejemplo n.º 1
0
        /// <summary>
        /// Update the Network and the NetworkLocation record
        /// </summary>
        /// <param name="Network">Network info to update</param>
        /// <returns>No of records</returns>
        public async Task <int> UpdateNetwork(UpdateNetwork Network)
        {
            //prepare the networklocation model.
            var network = _mapper.Map <Model.DTO.Network>(Network);

            //Update the Network
            var result = await _networkClient.UpdateNetwork(network);

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

                //create a Networklocation in DB
                result = await _networkLocationClient.UpdateNetworkLocation(netLocation);
            }

            return(result);
        }
Ejemplo n.º 2
0
        public async Task <object> PUT(UpdateNetwork request)
        {
            var response = new BaseResponse();
            //Expression<Func<ServiceModel.Network, bool>> keySelector = x => x.id == request.id;
            var networkUp = new ServiceModel.Network
            {
                id          = request.id,
                nameNetwork = request.nameNetwork
            };

            response.Results = await _netWorkService.Update(networkUp);

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