コード例 #1
0
        public ActionResult <CommandReadDto> CreateCommand(CommandCreateDto commandCreateDto)
        {
            var cmdModel = _mapper.Map <Command>(commandCreateDto);

            _repo.Create(cmdModel);
            _repo.Savechanges();

            var cmdCreateDto = _mapper.Map <CommandReadDto>(cmdModel);

            return(CreatedAtRoute(nameof(GetCommandById), new { id = cmdModel.Id }, cmdCreateDto));
        }