public IHttpActionResult DeletePolicy(int id)
        {
            var policyInDb = policyRepository.GetPolicy(id);

            if (policyInDb == null)
            {
                return(NotFound());
            }

            policyRepository.DeletePolicy(id);

            return(Ok());
        }
        public async Task <ActionResult <Policy> > DeletePolicy(int policyId)
        {
            var policy = await _policyRepository.FindPolicy(policyId);

            if (policy == null)
            {
                return(NotFound());
            }

            await _policyRepository.DeletePolicy(policy);

            return(policy);
        }
        public async Task <IActionResult> Delete([FromRoute] Guid clientId, Guid id)
        {
            if (await _clientRepository.GetClient(clientId) == null)
            {
                return(NotFound());
            }

            if (await _policyRepository.GetPolicy(id) == null)
            {
                return(NotFound());
            }

            await _policyRepository.DeletePolicy(id);

            return(NoContent());
        }
        public async Task <IActionResult> DeletePolicy([FromRoute] Guid policyId)
        {
            try
            {
                var result = await _policyRepository.DeletePolicy(policyId);

                if (result)
                {
                    return(Ok());
                }

                _logger.Log(LogLevel.Warning, $"Couldn't delete policy with id {policyId}");
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
            catch (Exception ex)
            {
                _logger.Log(LogLevel.Error, $"Error while call DeletePolicy - {ex}");
                return(BadRequest(ex.Message));
            }
        }
Esempio n. 5
0
 public void DeletePolicy(PolicyId policyId)
 {
     try
     {
         using (var scope = new TransactionScope())
         {
             var policy = policyRep.GetById(policyId);
             policyRep.DeletePolicy(policy);
             scope.Complete();
         }
     }
     catch (Exception exp)
     {
         var res = policyRep.TryConvertException(exp);
         if (res == null)
         {
             throw;
         }
         throw res;
     }
 }
Esempio n. 6
0
 public void DeletePolicy(int policyNumber)
 {
     _policyRepo.DeletePolicy(policyNumber);
 }
Esempio n. 7
0
 public void Delete([FromBody] PolicyDto policyDto)
 {
     _repository.DeletePolicy(policyDto);
 }
Esempio n. 8
0
 public IActionResult Delete(string id)
 {
     policyRepo.DeletePolicy(id);
     return(RedirectToAction("Index"));
 }