public IActionResult Post([FromBody] ElementoDTO value)
 {
     //Nuevo
     try
     {
         ElementoMapper.MapearElementoDTO2Elemento(value, _elemento);
         value.Id = _elemento.Anadir();
         return(Ok(value.Id));
     }
     catch (Exception)
     {
         //TODO Log
         return(this.Problem("Error interno", null, 500));
     }
 }
 public IActionResult Caducados()
 {
     try
     {
         var caducados    = _elemento.Caducados();
         var caducadosDTO = new List <ElementoDTO>();
         foreach (var elemento in caducados)
         {
             var elementoDTO = new ElementoDTO();
             ElementoMapper.MapearElemento2ElementoDTO(elemento, elementoDTO);
             caducadosDTO.Add(elementoDTO);
         }
         return(Ok(caducadosDTO));
     }
     catch (Exception)
     {
         //TODO Log
         return(this.Problem("Error interno", null, 500));
     }
 }
 public static void MapearElemento2ElementoDTO(IElemento elemento, ElementoDTO elementoDTO)
 {
     elementoDTO.Nombre    = elemento.Nombre;
     elementoDTO.Caducidad = elemento.Caducidad;
     elementoDTO.Tipo      = elemento.TipoElementoId;
 }
 public static void MapearElementoDTO2Elemento(ElementoDTO elementoDTO, IElemento elemento)
 {
     elemento.Nombre         = elementoDTO.Nombre;
     elemento.Caducidad      = elementoDTO.Caducidad;
     elemento.TipoElementoId = elementoDTO.Tipo;
 }