Esempio n. 1
0
            public override int GetHashCode()
            {
                if (!StoresIds.Any())
                {
                    return(Key.GetHashCode());
                }

                var storesIds = StoresIds.Select(id => id.ToString())
                                .Aggregate(string.Empty, (all, current) => all + current);

                return($"{storesIds}_{Key}".GetHashCode());
            }
Esempio n. 2
0
            public bool Equals(CategoryKey y)
            {
                if (y == null)
                {
                    return(false);
                }

                if (Category != null && y.Category != null)
                {
                    return(Category.Id == y.Category.Id);
                }

                if ((StoresIds.Any() || y.StoresIds.Any()) &&
                    (StoresIds.All(id => !y.StoresIds.Contains(id)) || y.StoresIds.All(id => !StoresIds.Contains(id))))
                {
                    return(false);
                }

                return(Key.Equals(y.Key));
            }