Esempio n. 1
0
        public async Task <ActionResult> DeleteValue([FromRoute] Guid id)
        {
            try
            {
                var deleteValueResult = await _valueService.DeleteAsync(id);

                if (!deleteValueResult.HasValue)
                {
                    return(NotFound(id));
                }

                return(NoContent());
            }
            catch (Exception ex)
            {
                return(ValidationProblem(ex.Message));
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var selectedValue = await _valueService.GetByIdAsync(id);

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

                var deletedValue = _valueService.DeleteAsync(id);
                return(NoContent());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(StatusCode(500));
            }
        }