示例#1
0
        public Period Delete(long id)
        {
            var period = _periodsRepository.Delete(id);

            if (period == null)
            {
                throw new NotFoundException("No se encontro el periodo");
            }
            _periodsRepository.Save();
            return(period);
        }
示例#2
0
        public async Task DeletePeriod(int periodId)
        {
            var periodToDelete = await _periodRepository.FindByIdAsync(periodId);

            if (periodToDelete == null)
            {
                throw new EntityNotFoundException($"Periode met ID {periodId} werd niet gevonden.");
            }
            _periodRepository.Delete(periodToDelete);
            await _periodRepository.SaveChangesAsync();
        }
示例#3
0
 public void Delete(PeriodId periodId)
 {
     try
     {
         using (var scope = new TransactionScope())
         {
             var period = periodRep.GetById(periodId);
             periodRep.Delete(period);
             scope.Complete();
         }
     }
     catch (Exception exp)
     {
         var res = periodRep.TryConvertException(exp);
         if (res == null)
         {
             throw;
         }
         throw res;
     }
 }
示例#4
0
 public Period Delete(int id)
 {
     return(_periodRepository.Delete(id));
 }