Esempio n. 1
0
        public ObjectResult Delete(int id)
        {
            var podcast = _podcastRepository.Buscar(id);

            if (podcast == null)
            {
                Response.StatusCode = StatusCodes.Status404NotFound;
                return(ResponseUtils.GenerateObjectResult("Podcast inexistente.", null));
            }
            try {
                _podcastRepository.Remover(podcast);
                Response.StatusCode = StatusCodes.Status200OK;
                return(ResponseUtils.GenerateObjectResult("Podcast excluído com sucesso!", podcast));
            } catch (Exception) {
                Response.StatusCode = StatusCodes.Status406NotAcceptable;
                return(ResponseUtils.GenerateObjectResult("Não foi possível excluir o podcast, contate o suporte!", podcast));
            }
        }