Ejemplo n.º 1
0
        public static internalDTO.ClientGroup MapFromDAL(externalDTO.ClientGroup clientGroup)
        {
            var res = clientGroup == null ? null : new internalDTO.ClientGroup
            {
                Id              = clientGroup.Id,
                Name            = new internalDTO.MultiLangString(clientGroup.Name),
                Description     = new internalDTO.MultiLangString(clientGroup.Description),
                DiscountPercent = clientGroup.DiscountPercent
            };

            return(res);
        }
Ejemplo n.º 2
0
        public override ClientGroup Update(ClientGroup entity)
        {
            var entityInDb = RepositoryDbSet
                             .Include(m => m.Name)
                             .ThenInclude(t => t.Translations)
                             .Include(m => m.Description)
                             .ThenInclude(t => t.Translations)
                             .FirstOrDefault(x => x.Id == entity.Id);

            entityInDb?.Name.SetTranslation(entity.Name);
            entityInDb?.Description.SetTranslation(entity.Description);

            return(entity);
        }