コード例 #1
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var entity = _service.DeleteAsync(id);

                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
コード例 #2
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                await _taskTypeService.DeleteAsync(id);

                return(Ok());
            }
            catch (ArgumentException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
コード例 #3
0
 public async Task <IActionResult> Delete(int id)
 {
     return(await DeleteAsync(
                async() => await _taskTypeService.TaskTypeExistsAsync(id),
                async() => await _taskTypeService.DeleteAsync(id)));
 }