Ejemplo n.º 1
0
        public async Task <IActionResult> DeleteAsync(int id)
        {
            var result = await _cocktailService.DeleteAsync(id);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }
            var cocktailResource = _mapper.Map <Domain.Models.Cocktail, CocktailResource>(result.Cocktail);

            return(Ok(cocktailResource));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> DeleteAsync([FromRoute] Guid id, CancellationToken cancellationToken)
        {
            try
            {
                await _service.DeleteAsync(id, cancellationToken);

                return(NoContent());
            }
            catch (NotFoundException ex)
            {
                return(NotFound(new ApiErrorResponse(404, ex.Message)));
            }
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Delete(CocktailModel cocktail)
        {
            var response = await service.DeleteAsync(cocktail);

            return(Json(response));
        }