예제 #1
0
        public static ObjetoDTO TransformarEntityEnDTO(ObjetoEntity entity, int atribPes)
        {
            ObjetoDTO dto = new ObjetoDTO();

            dto.Nombres         = MapperEstructurasUtilidades.CrearCadenaDTO(entity.Nombres, atribPes, null);
            dto.Apellidos       = MapperEstructurasUtilidades.CrearCadenaDTO(entity.Apellidos, atribPes, null);
            dto.Rut             = MapperEstructurasUtilidades.CrearEnteroDTO(entity.Rut, atribPes, null);
            dto.FechaNacimiento = MapperEstructurasUtilidades.CrearFechaDTO(entity.FechaNacimiento, atribPes, null);
            return(dto);
        }
예제 #2
0
        public static ObjetoEntity TransformarDTOEnEntity(ObjetoDTO dto)
        {
            ObjetoEntity entity = new ObjetoEntity();

            entity.Nombres         = MapperEstructurasUtilidades.ExtraerCadena(dto.Nombres);
            entity.Apellidos       = MapperEstructurasUtilidades.ExtraerCadena(dto.Apellidos);
            entity.Rut             = MapperEstructurasUtilidades.ExtraerEntero(dto.Rut);
            entity.FechaNacimiento = MapperEstructurasUtilidades.ExtraerFecha(dto.FechaNacimiento);
            return(entity);
        }
예제 #3
0
        public Objeto MapperToEntity(ObjetoDTO objetoDTO)
        {
            Objeto objeto = new Objeto
            {
                Id           = objetoDTO.Id,
                Peso         = objetoDTO.Peso,
                Altura       = objetoDTO.Altura,
                Largura      = objetoDTO.Largura,
                Profundidade = objetoDTO.Profundidade
            };

            return(objeto);
        }
예제 #4
0
        public ObjetoDTO MapperToDTO(Objeto objeto)
        {
            ObjetoDTO objetoDTO = new ObjetoDTO
            {
                Id           = objeto.Id,
                Peso         = objeto.Peso,
                Altura       = objeto.Altura,
                Largura      = objeto.Largura,
                Profundidade = objeto.Profundidade
            };

            return(objetoDTO);
        }
예제 #5
0
 public IEnumerable <ObjetoDTO> MapperListClientes(IEnumerable <Objeto> objetos)
 {
     foreach (var o in objetos)
     {
         ObjetoDTO objetoDTO = new ObjetoDTO
         {
             Id           = o.Id,
             Peso         = o.Peso,
             Altura       = o.Altura,
             Largura      = o.Largura,
             Profundidade = o.Profundidade
         };
         objetosDTO.Add(objetoDTO);
     }
     return(objetosDTO);
 }
예제 #6
0
        public ActionResult Edit(ObjetoDTO objetoDTO)
        {
            try
            {
                try
                {
                    _objetoServicoAplicacao.Atualizar(objetoDTO);
                }
                catch (Exception e)
                {
                    throw e;
                }

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
        public void Excluir(ObjetoDTO obj)
        {
            var objeto = _mapperObjeto.MapperToEntity(obj);

            _objetoServicoDominio.Excluir(objeto);
        }
        public void Atualizar(ObjetoDTO obj)
        {
            var objeto = _mapperObjeto.MapperToEntity(obj);

            _objetoServicoDominio.Atualizar(objeto);
        }
예제 #9
0
        public IHttpActionResult CaptureEntityToDTO(ObjetoEntity test)
        {
            ObjetoDTO dto = MapperUtilidades.TransformarEntityEnDTO(test, 0);

            return(Ok(dto));
        }
예제 #10
0
        public IHttpActionResult CaptureDTOToEntity(ObjetoDTO test)
        {
            ObjetoEntity entity = MapperUtilidades.TransformarDTOEnEntity(test);

            return(Ok(entity));
        }