Esempio n. 1
0
        /// <summary>
        /// Récupére l'entité désignée par l'id en paramétre.
        /// </summary>
        /// <param name="id">Id de l'entité</param>
        /// <returns>Message de retour avec l'entité</returns>
        public async Task <DTO.SelectorInstance> GetById(long id)
        {
            ENT.SelectorInstance selectorInstance = await SelectorInstanceDomain.Get(id);

            DTO.SelectorInstance dtoSelectorInstance = null;
            if (selectorInstance != null)
            {
                dtoSelectorInstance = Mapper.Map <ENT.SelectorInstance, DTO.SelectorInstance>(selectorInstance);
            }

            return(dtoSelectorInstance);
        }
Esempio n. 2
0
        /// <summary>
        /// Récupére toutes les entités DTO existantes.
        /// </summary>
        /// <returns>Message de retour avec la liste en json</returns>
        public async Task <IEnumerable <DTO.SelectorInstance> > GetAll()
        {
            IEnumerable <ENT.SelectorInstance> selectorInstance = await SelectorInstanceDomain.Get();

            IEnumerable <DTO.SelectorInstance> dtoSelectorInstance = null;

            if (selectorInstance != null)
            {
                dtoSelectorInstance = Mapper.Map <IEnumerable <ENT.SelectorInstance>, IEnumerable <DTO.SelectorInstance> >(selectorInstance);
            }
            else
            {
                dtoSelectorInstance = new List <DTO.SelectorInstance>();
            }

            return(dtoSelectorInstance);
        }