private void InitialiseRegionRestrictions() { foreach (var wr in _warehouseRegions) { var rs = RegionRestrictions.SingleOrDefault(x => x.RegionId == wr.RegionId); if (rs == null) { var regionRestriction = new RegionRestriction(wr.WarehouseId, wr.RegionId, false); RegionRestrictions.Add(regionRestriction); } } }
public void ApplyRestrictionAttributes(string[] attributes) { if (!RegionRestrictions.Any()) { InitialiseRegionRestrictions(); } foreach (var rr in RegionRestrictions) { foreach (var attribute in attributes) { rr.Restricted = _warehouseRegions.Any(x => x.Restrictions.Any(ra => ra == attribute) && x.RegionId == rr.RegionId); } } }