public (bool IsOperationalBeforeSet, bool IsOperationalAfterSet) SetAndReturnIsOperational(IEnumerable <string> markets) { var before = IsOperational; IsOperational = Markets.Any(market => markets.Contains(market)); return(before, IsOperational); }
/// <summary> /// Returns true if any of the markets includes a specified region. /// </summary> /// <param name="region">Region to check.</param> /// <returns>True if any of the markets includes a specified region; false otherwise.</returns> public bool IncludesRegion(string region) { if (Markets == null || Markets.Count == 0) { // there is no restriction on the market return(true); } return(Markets.Any(m => m.Split(s_marketDelimiters, StringSplitOptions.RemoveEmptyEntries).Last().Equals( region, StringComparison.OrdinalIgnoreCase))); }
public bool IsMarketEditable(int marketId) { return(Markets.Any(m => m.Action == UserAction.Edit && m.MarketId == marketId) || (HasEditRole() && HasAccessAllMarketsRole())); }