コード例 #1
0
        public async Task <ActionResult <bool> > Delete([FromBody] Guid id)
        {
            var result = await _objectiveService.Delete(id);

            if (result)
            {
                return(Ok());
            }
            throw new ObjectiveNotFoundException("Can't delete objective or objective has subobjectives");
        }
コード例 #2
0
        public async Task <IActionResult> Delete(Guid id)
        {
            try
            {
                var response = await _service.Delete(id);

                if (!response.IsSuccessful)
                {
                    return(BadRequest(response));
                }
                return(Ok(response));
            }
            catch
            {
                return(StatusCode(500, "Internal Server Error."));
            }
        }