Example #1
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState.GetErrorResponse()));
                }

                var result = await _service.Delete(id);

                if (!result.Success)
                {
                    return(BadRequest());
                }

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex?.InnerException?.Message ?? ex.Message));
            }
        }