コード例 #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);
        }