Exemplo n.º 1
0
        public async Task <ActionResult> Copy(FeatureMappingParameters parameters)
        {
            parameters.CopyToGateways = (IEnumerable <string>)TempData["CopyToGateways"];
            var derivativeMappingView = await GetModelFromParameters(parameters);

            if (derivativeMappingView.FeatureMapping is EmptyFdpFeatureMapping)
            {
                return(JsonGetFailure("FeatureMapping does not exist"));
            }

            derivativeMappingView.FeatureMapping = await DataContext.Vehicle.CopyFdpFeatureMappingToDocument(FdpFeatureMapping.FromParameters(parameters), parameters.TargetDocumentId.GetValueOrDefault());

            if (derivativeMappingView.FeatureMapping is EmptyFdpFeatureMapping)
            {
                return(JsonGetFailure(string.Format("FeatureMapping '{0}' could not be copied", derivativeMappingView.FeatureMapping.ImportFeatureCode)));
            }

            return(JsonGetSuccess());
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Delete(FeatureMappingParameters parameters)
        {
            var derivativeMappingView = await GetModelFromParameters(parameters);

            if (derivativeMappingView.FeatureMapping is EmptyFdpFeatureMapping)
            {
                return(JsonGetFailure("FeatureMapping does not exist"));
            }

            derivativeMappingView.FeatureMapping = await DataContext.Vehicle.DeleteFdpFeatureMapping(FdpFeatureMapping.FromParameters(parameters));

            if (derivativeMappingView.FeatureMapping is EmptyFdpFeatureMapping)
            {
                return(JsonGetFailure(string.Format("FeatureMapping '{0}' could not be deleted", derivativeMappingView.FeatureMapping.ImportFeatureCode)));
            }

            return(JsonGetSuccess());
        }