Exemplo n.º 1
0
        public async Task <IActionResult> Create([FromBody] ServerCreateViewModel viewModel)
        {
            var model = new ServerModel
            {
                Name         = viewModel.Name,
                ResourceType = new ResourceTypeModel
                {
                    Id         = (ResourceType)viewModel.ResourceType.Id,
                    Properties = viewModel.ResourceType.Properties
                                 .Select(q => new ResourcePropertiesModel {
                        Property = q.Property
                    }).ToList()
                }
            };

            var result = await _cloudService.CreateAsync(model);

            return(Ok(result));
        }