Ejemplo n.º 1
0
        public static DrinkEntity ToEntity(this DrinkDto dto)
        {
            var entity = new DrinkEntity
            {
                Id               = dto.Id,
                Name             = dto.Name,
                Price            = dto.Price,
                DrinkIngredients = dto.DrinkIngredients != null?dto.DrinkIngredients.Select(di => di.ToEntity()).ToList() : new List <DrinkIngredient>()
            };

            return(entity);
        }
Ejemplo n.º 2
0
        public static DrinkDto ToDto(this DrinkEntity entity)
        {
            var dto = new DrinkDto
            {
                Id               = entity.Id,
                Name             = entity.Name,
                Price            = entity.Price,
                DrinkIngredients = entity.DrinkIngredients.Select(di => di.ToDto()).ToList()
            };

            return(dto);
        }