public async Task <IActionResult> Start(Vm vM) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (vM?.Adapter == null) { return(BadRequest()); } Adapter adapter = await _context.Adapters.Where(x => x.IsOK) .Include(c => c.Credentials) .Include(p => p.Provider) .Where(a => a.Id == vM.Adapter.Id) .SingleOrDefaultAsync(); ServicesResponse shutdownVmResponse = new ServicesResponse(); switch (adapter.Provider.Name.ToLower()) { case "ovirt": shutdownVmResponse = await VmService.StartVm(adapter, vM.Id); if (shutdownVmResponse.isSuccess) { } else { return(BadRequest(shutdownVmResponse.errorMessage)); } break; } return(Ok(shutdownVmResponse)); }