コード例 #1
0
        public async Task <IHttpActionResult> DeletePolicy(int id)
        {
            var deletedPolicy = await _policyService.GetByIdAsync(id);

            if (deletedPolicy == null)
            {
                return(NotFound());
            }
            try
            {
                await _policyService.DeleteAsync(deletedPolicy);
            }
            catch (DbUpdateConcurrencyException)
            {
                return(Conflict());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
            return(Ok());
        }