public async Task <StatusCodeResult> Delete(int id)
 {
     if (await _service.DeleteAsync(id) == 1)
     {
         return(StatusCode((int)HttpStatusCode.OK));
     }
     else
     {
         return(StatusCode((int)HttpStatusCode.ExpectationFailed));
     }
 }
Beispiel #2
0
        public async Task <IActionResult> Delete(Guid id)
        {
            var policy = await _policyRepository.GetByIdAsync(id);

            if (policy == null || policy.OrganizationId != _currentContext.OrganizationId)
            {
                return(new NotFoundResult());
            }
            await _policyRepository.DeleteAsync(policy);

            return(new OkResult());
        }
        public async Task <DeleteResponse> DeleteAsync(int id)
        {
            var deleteResponse = new DeleteResponse();

            try
            {
                deleteResponse = await _policyRepository.DeleteAsync(id);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                deleteResponse.AddError(ex);
                _logManager.LogError(ex, "Unable to delete policy");
            }

            return(deleteResponse);
        }
Beispiel #4
0
        public async Task DeleteAsync(Policy policy)
        {
            await _policyRepository.DeleteAsync(policy);

            await _eventService.LogPolicyEventAsync(policy, Enums.EventType.Policy_Deleted);
        }