private IEnumerable<School> GetSelectedSchools(bool allSchoolsSelected, Role role, IEnumerable<int> SelectedSchoolIds) { if (role.Name.Equals(SecurityRoles.SiteCoordinator)) { if (allSchoolsSelected) { return SchoolRepository.Items; } if (SelectedSchoolIds != null && SelectedSchoolIds.Any()) { return SchoolRepository.Items.Where(school => SelectedSchoolIds.Contains(school.Id)); } } return Enumerable.Empty<School>(); }
public void Update(Role item) { throw new NotSupportedException("Update is not supported in this repository"); }
private IEnumerable<Provider> GetSelectedProviders(Role role, IEnumerable<int> SelectedProviderIds) { if (role.Name.Equals(SecurityRoles.Provider)) { if (SelectedProviderIds != null && SelectedProviderIds.Any()) { return ProviderRepository.Items.Where(provider => SelectedProviderIds.Contains(provider.Id)); } } return Enumerable.Empty<Provider>(); }
public void Remove(Role item) { throw new NotSupportedException("Remove is not supported in this repository"); }
public void Add(Role item) { throw new NotSupportedException("Add is not supported in this repository"); }
public void GivenARole_WhenUpdate_ThenContextSetsModified() { var expected = new Role { Id = 1 }; Target.ExpectException<NotSupportedException>(() => Target.Update(expected)); }
public void GivenARole_WhenDelete_ThenRemoveFromContext() { var item = new Role { Id = 1 }; Target.ExpectException<NotSupportedException>(() => Target.Remove(item)); }
public void GivenARole_WhenAdd_ThenAddToContext() { var expected = new Role { Id = 1 }; Target.ExpectException<NotSupportedException>(() => Target.Add(expected)); }