Exemplo n.º 1
0
        public async Task <IActionResult> DeletePositionAsync([FromRoute][Required] int id)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(new ResponseErrorDto((int)HttpStatusCode.BadRequest, "Review Required Parameters")));
                }
                await _animalService.DeleteAnimalAsync(id);

                return(Ok(new ResponseDto <string>((int)HttpStatusCode.OK, "Ok")));
            }
            catch (ExceptionDto exdto)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, new ResponseErrorDto((int)HttpStatusCode.InternalServerError, exdto.UserMessage, exdto.Id)));
            }
            catch (Exception ex)
            {
                var guid = Guid.NewGuid();
                _logger.Log(LogLevel.Error, ex, guid.ToString());
                return(BadRequest(new ResponseErrorDto((int)HttpStatusCode.BadRequest, "Failed to create the animal information.", guid)));
            }
        }
        public async Task <IActionResult> DeleteAnimal(Guid animalId)
        {
            await _animalManager.DeleteAnimalAsync(animalId);

            return(Ok());
        }