Пример #1
0
        /// <summary>
        ///     Get group by Id
        /// </summary>
        /// <param name="groupId"></param>
        /// <returns></returns>
        public Group GetGroup(int groupId)
        {
            _logger.LogInformation($"BEGIN GetGroup");
            try
            {
                var group = _groupRepository.GetGroup(groupId);

                if (group == null)
                {
                    return(null);
                }

                var result = new Group
                {
                    Id          = group.GroupId,
                    Modified    = group.Group.Modified,
                    Name        = group.Name,
                    VirtualName = group.Name.RemoveDiacritics()
                };
                return(result);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Exception on GetGroup with message: {ex.Message}");
                return(null);
            }
        }
Пример #2
0
        private IEnumerable <Group> MapGroups(IEnumerable <GroupMultilingual> groups)
        {
            var collection = new List <Group>();

            foreach (var group in groups)
            {
                var result = new Group
                {
                    Id          = group.GroupId,
                    Name        = group.Name,
                    Modified    = group.Group.Modified,
                    VirtualName = group.Name.RemoveDiacritics()
                };

                collection.Add(result);
            }

            return(collection.Count == 0 ? null : collection);
        }
Пример #3
0
        private IEnumerable <Group> MapProductGroups(IEnumerable <ProductGroup> groups)
        {
            var collection = new List <Group>();

            foreach (var group in groups)
            {
                var groupDetail = _groupRepository.GetGroup(group.GroupId);

                var result = new Group
                {
                    Id          = group.GroupId,
                    Name        = groupDetail.Name,
                    Modified    = groupDetail.Group.Modified,
                    VirtualName = groupDetail.Name.RemoveDiacritics()
                };

                collection.Add(result);
            }

            return(collection.Count == 0 ? null : collection);
        }