コード例 #1
0
        private static UpdateModelApiDto BuildUpdateModelApiDto(Guid modelId, Guid netId1, Guid netId2)
        {
            var networks = new List <UpdateModelNetworkPortDto>
            {
                new UpdateModelNetworkPortDto
                {
                    Id     = netId1,
                    Name   = "eth0",
                    Number = 1
                },
                new UpdateModelNetworkPortDto
                {
                    Id     = netId2,
                    Name   = "eth1",
                    Number = 2
                }
            };
            var model = new UpdateModelApiDto
            {
                Id            = modelId,
                Vendor        = "foo vendor",
                ModelNumber   = "foo model number",
                Height        = 4,
                DisplayColor  = "#000fff",
                EthernetPorts = 2,
                PowerPorts    = 2,
                Cpu           = "foo cpu",
                Memory        = 16,
                Storage       = "foo storage",
                Comment       = "foo comment",
                NetworkPorts  = networks
            };

            return(model);
        }
コード例 #2
0
        public async Task <IActionResult> Put(UpdateModelApiDto modelApiDto)
        {
            var modelDto = _mapper.Map <ModelDto>(modelApiDto);
            await _modelService.UpdateModelAsync(modelDto);

            return(NoContent());
        }