Beispiel #1
0
 /// <summary>
 /// 删除一个政策主表
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="id">一政策主表的主键</param>
 /// <returns></returns>
 public bool Delete(ref ValidationErrors validationErrors, string id)
 {
     try
     {
         return(repository.Delete(id) == 1);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }
Beispiel #2
0
        public IActionResult Delete([FromBody] int id)
        {
            if (id <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(id));
            }

            var model = _insuranceRepository.Get(id);

            if (model == null)
            {
                throw new InvalidOperationException();
            }
            if (model.Status > InsuranceStatus.Draft)
            {
                throw new PawnshopApplicationException("Запрещено удалять подписанные страховые договоры");
            }

            _insuranceRepository.Delete(id);
            return(Ok());
        }