예제 #1
0
        public async Task <ActionResult <Vm> > ChangeVm([FromBody] VmOperation op)
        {
            string opType = op.Type.ToString().ToLower();

            await AuthorizeAction(op.Id, opType);

            if (
                op.Type == VmOperationType.Save &&
                op.WorkspaceId > 0 &&
                await _workspaceService.HasGames(op.WorkspaceId)
                )
            {
                throw new WorkspaceNotIsolatedException();
            }

            Vm vm = await _pod.ChangeState(op);

            SendBroadcast(vm, opType);

            return(Ok(vm));
        }