public void Edit(TipoDocumentoDto entity)
 {
     try
     {
         uowService.TipoDocumentoRepository.Edit(mapper.Map <TipoDocumento>(entity));
         uowService.Save();
     }
     catch (ExceptionData)
     {
         throw;
     }
     catch (Exception ex)
     {
         throw new ExceptionCore("error al intentar editar el TD", ex);
     }
 }
 public void Add(TipoDocumentoDto dto)
 {
     try
     {
         uowService.TipoDocumentoRepository.Add(mapper.Map <TipoDocumento>(dto));
         uowService.Save();
     }
     catch (ExceptionData)
     {
         throw;
     }
     catch (Exception ex)
     {
         throw new ExceptionCore("error al intentar agregar el TD", ex);
     }
 }
 public IActionResult Post(TipoDocumentoDto td)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         tdService.Add(td);
         return(Ok(td));
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#4
0
        internal override DtoBase PopulateDto(OracleDataReader reader)
        {
            var tipoDocumento = new TipoDocumentoDto();

            //
            if (!reader.IsDBNull(_ordTpdId))
            {
                tipoDocumento.TpdId = reader.GetInt32(_ordTpdId);
            }
            //
            if (!reader.IsDBNull(_ordTpdDescripcion))
            {
                tipoDocumento.TpdDescripcion = reader.GetString(_ordTpdDescripcion);
            }
            // IsNew
            tipoDocumento.IsNew = false;

            return(tipoDocumento);
        }
 public IActionResult Put(int id, TipoDocumentoDto td)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         var entity = tdService.Find(id);
         if (entity == null)
         {
             return(NotFound());
         }
         tdService.Edit(td);
         return(Ok(td));
     }
     catch (Exception)
     {
         throw;
     }
 }