Example #1
0
        public async Task <IActionResult> DeleteGasto(int id)
        {
            ServiceResponse <IEnumerable <GetGastoDto> > response = await _gastoService.DeleteGasto(id);

            if (response.Data == null)
            {
                return(NotFound(response));
            }

            return(Ok(response));
        }
        public async Task <IActionResult> DeleteGasto(Guid id)
        {
            if (id == null)
            {
                return(BadRequest());
            }
            var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var gasto  = await _gastoService.GetGastoById(id, userId);

            if (gasto == null)
            {
                return(NotFound());
            }

            await _gastoService.DeleteGasto(gasto);

            return(NoContent());
        }
Example #3
0
 public async Task <IActionResult> Delete(int id)
 => Ok(new ApiResponse <bool>(await _gastoService.DeleteGasto(id)));