Exemplo n.º 1
0
        public IActionResult Remove(int id)
        {
            Elephant elephant = ElephantRepository.Remove(id);

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

            return(Ok(elephant));
        }
Exemplo n.º 2
0
        public IActionResult GetOne([FromRoute] int id)
        {
            Elephant elephant = ElephantRepository.GetOne(id);

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

            return(Ok(elephant));
        }
Exemplo n.º 3
0
        public IActionResult Update(int id, JsonPatchDocument <Elephant> jsonPatch)
        {
            Elephant elephant = ElephantRepository.GetOne(id);

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

            jsonPatch.ApplyTo(elephant);

            return(Ok(elephant));
        }
Exemplo n.º 4
0
        public IActionResult Save(ElephantTargetBinding target)
        {
            Elephant elephant = target.ToElephant();

            return(Ok(ElephantRepository.Save(elephant)));
        }
Exemplo n.º 5
0
 public IActionResult GetAll() => Ok(ElephantRepository.GetAll());