private bool IsUniqueName(string extraKeyName, string productKey)
        {
            var product = _monitoringCore.GetProduct(productKey);

            return(product?.ExtraKeys?.FirstOrDefault(x
                                                      => x.Name.Equals(extraKeyName,
                                                                       System.StringComparison.InvariantCultureIgnoreCase)) == null);
        }
Example #2
0
        public IActionResult EditProduct([FromQuery(Name = "Product")] string productKey)
        {
            var product = _monitoringCore.GetProduct(productKey);
            var users   = _userManager.GetViewers(productKey);

            var pairs = new List <KeyValuePair <User, ProductRoleEnum> >();

            if (users != null || users.Any())
            {
                foreach (var user in users.OrderBy(x => x.UserName))
                {
                    pairs.Add(new KeyValuePair <User, ProductRoleEnum>(user,
                                                                       user.ProductsRoles.First(x => x.Key.Equals(product.Key)).Value));
                }
            }

            return(View(new EditProductViewModel(product, pairs)));
        }