示例#1
0
        public async Task <ActionResult <Zoo> > Add(
            [FromBody] Zoo animal)
        {
            try
            {
                await _repo.Add(animal);

                return(CreatedAtAction(nameof(GetAnimal), new { id = animal.Id }, animal));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(new BadRequestResult());
            }
        }