public IActionResult Create([FromBody] CreateInfrastructureRequest request)
 {
     if (ModelState.IsValid)
     {
         var providerName = RouteData.Values["providerName"].ToString();
         var response     = _infrastructureService.CreateInfrastructure(providerName, request);
         if (response.OperationStatus == OperationStatus.Success)
         {
             return(Ok(response));
         }
         return(BadRequest(response));
     }
     return(BadRequest());
 }
        public CreateInfrastructureResponse CreateInfrastructure(string providerName, CreateInfrastructureRequest request)
        {
            var response       = new CreateInfrastructureResponse();
            var infrastructure = new Infrastructure
            {
                Name     = request.Name,
                Address  = Path.Combine(providerName, request.Name),
                Location = request.Location
            };

            if (_unitOfWorkBase.CloudProviders.Find(providerName).Any())
            {
                var cloudProvider = _unitOfWorkBase.CloudProviders.Get(providerName);
                infrastructure.CloudProvider = cloudProvider;
                var infrastructureCreated = _unitOfWorkBase.Infrastructures.Add(infrastructure);
                response.Infrastructure  = infrastructureCreated;
                response.OperationStatus = OperationStatus.Success;
            }
            else
            {
                response.OperationStatus = OperationStatus.Failed;
                response.Description     = $"This cloud provider {providerName} doesn't exist";
            }
            return(response);
        }