コード例 #1
0
        public async Task <ActionResult> Delete(int eventId, int batchId)
        {
            try
            {
                BatchDto batchToDelete = await _batchService.GetBatchByIdAsync(eventId, batchId);

                if (batchToDelete == null)
                {
                    return(NoContent());
                }

                return(await _batchService.DeleteBatch(batchToDelete.EventId, batchToDelete.Id)
                ? Ok(new { messa = "Lote Deletado" }) : throw new Exception("Ocorreu um problema ao deletar o lote."));
            }
            catch (Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError,
                                       $"Erro ao tentar excluir batchos. Erro: {ex.Message}"));
            }
        }