コード例 #1
0
        public async Task <IActionResult> FindWord(int id)
        {
            var obj = await _repository.FindWordAsync(id);

            if (obj == null)
            {
                return(NotFound());
            }

            DTOWord wordDTO = _mapper.Map <Word, DTOWord>(obj);

            wordDTO.Links.Add(new DTOLink("self", Url.Link("FindWord", new { id = wordDTO.Id }), "GET"));
            wordDTO.Links.Add(new DTOLink("update", Url.Link("UpdateWord", new { id = wordDTO.Id }), "PUT"));
            wordDTO.Links.Add(new DTOLink("delete", Url.Link("DeleteWord", new { id = wordDTO.Id }), "DELETE"));

            return(Ok(wordDTO));
        }