Esempio n. 1
0
 public Int32 Create(SEXO item, LOG log)
 {
     using (DbContextTransaction transaction = Db.Database.BeginTransaction(IsolationLevel.ReadCommitted))
     {
         try
         {
             _logRepository.Add(log);
             _baseRepository.Add(item);
             transaction.Commit();
             return(0);
         }
         catch (Exception ex)
         {
             transaction.Rollback();
             throw ex;
         }
     }
 }
Esempio n. 2
0
        public async Task <SexoResponse> AddSexoAsync(AddSexoRequest request)
        {
            var sexo   = _sexoMapper.Map(request);
            var result = _sexoRepository.Add(sexo);

            var registrosModificados = await _sexoRepository
                                       .UnitOfWork.SaveChangesAsync();

            _logger.LogInformation(
                Events.Add,
                Messages.NumberOfRecordAffected_modifiedRecords, registrosModificados);

            _logger.LogInformation(
                Events.Add,
                Messages.ChangesApplied_id, result?.SexoId);

            return(_sexoMapper.Map(result));
        }