public DesignRequestListVm(IRepository<Request> requestRepository, IRepository<City> cityRepository, IEventAggregator eventAggregator, NavigationService navigationService) { _requestRepository = requestRepository; _cityRepository = cityRepository; _eventAggregator = eventAggregator; _navigationService = navigationService; Items = new ObservableCollection<RequestVm>(_requestRepository.GetAll().Select(x => new RequestVm(x))); _eventAggregator.GetEvent<ChangeAcceptedEvent<Hangar>>().Subscribe(_ => { new ObservableCollection<RequestVm>(_requestRepository.GetAll().Select(x => new RequestVm(x))); }); }
public OperationsClassifier(IRepository<ClassificationDefinition> classificationRepository, IRepository<BankAccount> accountsRepository) { _definitionsToApply = classificationRepository .GetAll() .Select(def => new RegularExpressionClassificationRule(def, accountsRepository)); }
public ActionResult Create(UserInputModel userInputModel) { _repository = new InMemoryRepository(); _authenticator = new CookieAuthenticator(); if (_repository.GetAll<User>().Any(x => x.Username == userInputModel.Username)) { ModelState.AddModelError("Username", "Username is already in use"); } if (ModelState.IsValid) { var user = new User { Id = Guid.NewGuid(), Username = userInputModel.Username, Password = HashPassword(userInputModel.Password), }; _repository.SaveOrUpdate(user); _authenticator.SetCookie("72201781859E67D4F633C34381EFE4BC928656AEE324A4B00CADA968ACD6CF33047E47479B0B68050FF4A0DB13688B5C78DAFDF53252A94E7F1D7B58A6FFD95D747F3D3AA761DECA7B6358A2E78B85D868833A9420316BDA8A5A0425D543AC1148CB69B902195C20065446A5E5F7A8E4C94A04A22304680E1211F00A12DF5E8777A343D08D0F8C0A3BFC471381E9B070E0F0608ADAEBCA8E233A21251BF57A03B52C1F03B7169CFC7C98216E7217EA649C4EDBD35E07F11A2444D40BE303BFFA28BAA921CDCC298D09A6E0297ED7D6E8"); return RedirectToAction("Index", "Home"); } return View("New", userInputModel); }
protected override void EstablishContext() { //Prepare supplied data collections suppliedStudentInformationData = GetSuppliedStudentInformation(); suppliedRootMetricNode = GetSuppliedRootNode(); suppliedRootMetricHierarchy = GetSuppliedRootMetricHierarchy(); suppliedRootIEnumerableOfKeyValuePair = GetSuppliedRootKeyValuePairs(); //Set up the mocks studentInformationRepository = mocks.StrictMock<IRepository<StudentInformation>>(); rootMetricNodeResolver = mocks.StrictMock<IRootMetricNodeResolver>(); domainMetricService = mocks.StrictMock<IDomainMetricService<StudentSchoolMetricInstanceSetRequest>>(); metricTreeToIEnumerableOfKeyValuePairProvider = mocks.StrictMock<IMetricTreeToIEnumerableOfKeyValuePairProvider>(); //Set expectations Expect.Call(studentInformationRepository.GetAll()).Return(suppliedStudentInformationData); Expect.Call(rootMetricNodeResolver.GetRootMetricNode()).Return(suppliedRootMetricNode); Expect.Call(domainMetricService.Get(null)) .Constraints( new ActionConstraint<StudentSchoolMetricInstanceSetRequest>(x => { Assert.That(x.SchoolId == suppliedSchoolId); Assert.That(x.StudentUSI == suppliedStudentUSI); Assert.That(x.MetricVariantId == suppliedRootMetricNode.MetricVariantId); }) ).Return(suppliedRootMetricHierarchy); Expect.Call(metricTreeToIEnumerableOfKeyValuePairProvider.FlattenMetricTree((ContainerMetric) suppliedRootMetricHierarchy.RootNode)).Return(suppliedRootIEnumerableOfKeyValuePair); }
protected override void EstablishContext() { //Prepare supplied data collections suppliedListMetadata = GetSuppliedListMetadata(); suppliedStudentRow = GetSuppliedStudentRow(); suppliedPriorYearStudentRow = GetSuppliedPriorYearStudentList(); suppliedMetricVariants = GetSuppliedMetricVariants(); //Set up the mocks listMetadataProvider = mocks.StrictMock<IListMetadataProvider>(); studentListUtilitiesProvider = mocks.StrictMock<IStudentListUtilitiesProvider>(); trendRenderingDispositionProvider = mocks.StrictMock<ITrendRenderingDispositionProvider>(); metricStateProvider = mocks.StrictMock<IMetricStateProvider>(); metricVariantRepository = mocks.StrictMock<IRepository<MetricVariant>>(); windsorContainer = new WindsorContainer(); windsorContainer.Kernel.Resolver.AddSubResolver(new ArrayResolver(windsorContainer.Kernel)); RegisterProviders(windsorContainer); IoC.Initialize(windsorContainer); additionalPriorYearMetricProvider = IoC.Resolve<IAdditionalPriorYearMetricProvider>(); Expect.Call(metricVariantRepository.GetAll()) .Return(suppliedMetricVariants.AsQueryable()).Repeat.AtLeastOnce(); }
static async Task MainAsync(IRepository<SampleEntity> repo) { foreach (var s in await repo.GetAllAsync()) { Console.WriteLine("{0} | {1}", s.ID, s.Name); } // Paged Set // Console.WriteLine("\nPage = 2 - Page Size = 2 :"); var some = await repo.GetAsync(2, 2, s => s.ID); foreach (var s in some) { Console.WriteLine("{0} | {1}", s.ID, s.Name); } // Updating // var fox = await repo.FindAsync(e => e.Name == "Fox"); fox.Name = "Dog"; repo.Update(fox, fox.ID); // Deleting // Console.WriteLine("\n " + await repo.DeleteAsync(repo.Get(5)) + "\n"); foreach (var e in repo.GetAll()) Console.WriteLine(e.ID + " | " + e.Name); }
public void Add_Should_Result_In_Proper_Total_Items(IRepository<Contact, string> repository) { repository.Add(new Contact { Name = "Test User" }); var result = repository.GetAll(); result.Count().ShouldEqual(1); }
protected override void EstablishContext() { SetSuppliedGoal(); base.EstablishContext(); suppliedData = GetData(); repository = mocks.StrictMock<IRepository<SchoolMetricGradeDistribution>>(); metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<SchoolMetricInstanceSetRequest>>(); metricGoalProvider = mocks.StrictMock<IMetricGoalProvider>(); metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>(); Expect.Call(metricNodeResolver.GetMetricNodeForSchoolFromMetricVariantId(suppliedSchoolId, suppliedMetricVariantId)).Return(GetSuppliedMetricMetadataNode()); Expect.Call(repository.GetAll()).Return(suppliedData); Expect.Call(metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null)) .Constraints( new ActionConstraint<SchoolMetricInstanceSetRequest>(x => { Assert.That(x.SchoolId == suppliedSchoolId); Assert.That(x.MetricVariantId == suppliedMetricVariantId); }) ).Return(suppliedMetricInstanceSetKey); Expect.Call(metricGoalProvider.GetMetricGoal(suppliedMetricInstanceSetKey, suppliedMetricId)).Return(suppliedGoal); }
protected override void EstablishContext() { metadataListRepository = mocks.StrictMock<IRepository<MetadataList>>(); Expect.Call(metadataListRepository.GetAll()).Repeat.Any().Return(GetMetadataList()); base.EstablishContext(); }
protected override void EstablishContext() { staffCohortRepository = mocks.StrictMock<IRepository<StaffCohort>>(); staffStudentCohortRepository = mocks.StrictMock<IRepository<StaffStudentCohort>>(); staffCustomStudentListRepository = mocks.StrictMock<IRepository<StaffCustomStudentList>>(); staffCustomStudentListStudentRepository = mocks.StrictMock<IRepository<StaffCustomStudentListStudent>>(); schoolInformationRepository = mocks.StrictMock<IRepository<SchoolInformation>>(); studentInformationRepository = mocks.StrictMock<IRepository<StudentInformation>>(); studentSchoolInformationRepository = mocks.StrictMock<IRepository<StudentSchoolInformation>>(); studentIndicatorRepository = mocks.StrictMock<IRepository<StudentIndicator>>(); metricInstanceRepository = mocks.StrictMock<IRepository<MetricInstance>>(); studentSchoolMetricInstanceSetRepository = mocks.StrictMock<IRepository<StudentSchoolMetricInstanceSet>>(); rootMetricNodeResolver = mocks.StrictMock<IRootMetricNodeResolver>(); gradeLevelUtilitiesProvider = new GradeLevelUtilitiesProvider(); Expect.Call(staffCohortRepository.GetAll()).Repeat.Any().Return(GetStaffCohortRepositoryInformation()); Expect.Call(staffStudentCohortRepository.GetAll()).Repeat.Any().Return(GetStaffStudentCohortRepositoryInformation()); Expect.Call(staffCustomStudentListRepository.GetAll()).Repeat.Any().Return(GetStaffCustomStudentListRepositoryInformation()); Expect.Call(staffCustomStudentListStudentRepository.GetAll()).Repeat.Any().Return(GetStaffCustomStudentListStudentRepositoryInformation()); Expect.Call(schoolInformationRepository.GetAll()).Repeat.Any().Return(GetSchoolInformation()); Expect.Call(studentInformationRepository.GetAll()).Repeat.Any().Return(GetStudentInformation()); Expect.Call(studentSchoolInformationRepository.GetAll()).Repeat.Any().Return(GetStudentSchoolInformation()); Expect.Call(metricInstanceRepository.GetAll()).Return(GetMetricInstance()); Expect.Call(studentSchoolMetricInstanceSetRepository.GetAll()).Return(GetStudentSchoolMetricInstanceSet()); Expect.Call(rootMetricNodeResolver.GetRootMetricNodeForStudent(suppliedSchoolId1)).Repeat.Any().Return(GetSuppliedMetadataHierarchy().Children.First()); base.EstablishContext(); }
protected override void EstablishContext() { schoolMetricTeacherListRepository = mocks.StrictMock<IRepository<SchoolMetricTeacherList>>(); staffInformationRepository = mocks.StrictMock<IRepository<StaffInformation>>(); staffEducationOrgInformationRepository = mocks.StrictMock<IRepository<StaffEducationOrgInformation>>(); footnoteRepository = mocks.StrictMock<IRepository<MetricInstanceFootnote>>(); uniqueListIdProvider = mocks.StrictMock<IUniqueListIdProvider>(); metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<SchoolMetricInstanceSetRequest>>(); metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>(); suppliedSchoolMetricTeacherList = GetSuppliedSchoolMetricTeacherList(); suppliedStaffInformationList = GetSuppliedStaffInformationList(); suppliedStaffEducationOrgInformationList = GetSuppliedStaffEducationOrgInformationList(); suppliedFootnoteList = GetSuppliedFootnoteList(); Expect.Call(metricNodeResolver.GetMetricNodeForSchoolFromMetricVariantId(suppliedSchoolId, suppliedMetricVariantId)).Return(GetSuppliedMetricMetadataNode()); Expect.Call(schoolMetricTeacherListRepository.GetAll()).Repeat.Any().Return(suppliedSchoolMetricTeacherList); Expect.Call(staffEducationOrgInformationRepository.GetAll()).Repeat.Any().Return(suppliedStaffEducationOrgInformationList); Expect.Call(staffInformationRepository.GetAll()).Repeat.Any().Return(suppliedStaffInformationList); Expect.Call(footnoteRepository.GetAll()).Repeat.Any().Return(suppliedFootnoteList); Expect.Call(uniqueListIdProvider.GetUniqueId(suppliedMetricVariantId)).Return(suppliedUniqueListId); Expect.Call(metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null)) .Constraints( new ActionConstraint<SchoolMetricInstanceSetRequest>(x => { Assert.That(x.SchoolId == suppliedSchoolId); Assert.That(x.MetricVariantId == suppliedMetricVariantId); }) ).Return(suppliedMetricInstanceSetKey); }
protected override void EstablishContext() { LeaContextProvider = mocks.StrictMock<ILocalEducationAgencyContextProvider>(); LocalEducationAgencyApplicationRepository = mocks.StrictMock<IRepository<EdFi.Dashboards.Application.Data.Entities.LocalEducationAgency>>(); LocalEducationAgencyApplicationAuthRepository = mocks.StrictMock<IRepository<Dashboards.Application.Data.Entities.LocalEducationAgencyAuthentication>>(); Expect.Call(LeaContextProvider.GetCurrentLocalEducationAgencyCode()).Repeat.Any().Return("1"); Expect.Call(LocalEducationAgencyApplicationRepository.GetAll()).Repeat.Any().Return(new List<Dashboards.Application.Data.Entities.LocalEducationAgency> { new Dashboards.Application.Data.Entities.LocalEducationAgency { LocalEducationAgencyId = 1, Name = "Test", Code = "1" } }.AsQueryable()); Expect.Call(LocalEducationAgencyApplicationAuthRepository.GetAll()).Repeat.Any().Return(new List<Dashboards.Application.Data.Entities.LocalEducationAgencyAuthentication> { new LocalEducationAgencyAuthentication { LocalEducationAgencyId = 1, StaffInformationLookupKey = ExpectedValue, LdapLookupKey = string.Empty } }.AsQueryable()); base.EstablishContext(); }
protected override void EstablishContext() { staffStudentCohortRepository = mocks.StrictMock<IRepository<StaffStudentCohort>>(); Expect.Call(staffStudentCohortRepository.GetAll()).Return(new List<StaffStudentCohort> { new StaffStudentCohort { StaffCohortId = 1, StudentUSI = 1 }, new StaffStudentCohort { StaffCohortId = 2, StudentUSI = 2 }, new StaffStudentCohort { StaffCohortId = 2, StudentUSI = 3 }, }.AsQueryable()).Repeat.Any(); staffCohortRepository = mocks.StrictMock<IRepository<StaffCohort>>(); Expect.Call(staffCohortRepository.GetAll()).Return(new List<StaffCohort> { new StaffCohort { StaffCohortId = 1, }, new StaffCohort { StaffCohortId = 2, }, }.AsQueryable()).Repeat.Any(); staffStudentAssociationRepository = mocks.StrictMock<IRepository<StaffStudentAssociation>>(); Expect.Call(staffStudentAssociationRepository.GetAll()).Return(new List<StaffStudentAssociation>().AsQueryable()).Repeat.Any(); query = new List<EnhancedStudentInformation> { new EnhancedStudentInformation { StudentUSI = 1, }, new EnhancedStudentInformation { StudentUSI = 2, }, new EnhancedStudentInformation { StudentUSI = 3, }, }.AsQueryable(); filter = new StaffCohortFilter(staffStudentCohortRepository); base.EstablishContext(); }
protected override void EstablishContext() { schoolMetricInstanceTeacherListRepository = mocks.StrictMock<IRepository<SchoolMetricInstanceTeacherList>>(); staffInformationRepository = mocks.StrictMock<IRepository<StaffInformation>>(); staffEdOrgRepository = mocks.StrictMock<IRepository<StaffEducationOrgInformation>>(); uniqueListProvider = mocks.StrictMock<IUniqueListIdProvider>(); metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>(); staffLinks = mocks.StrictMock<IStaffAreaLinks>(); codeIdProvider = mocks.StrictMock<ICodeIdProvider>(); localEducationAgencyContextProvider = mocks.StrictMock<ILocalEducationAgencyContextProvider>(); warehouseAvailabilityProvider = mocks.StrictMock<IWarehouseAvailabilityProvider>(); maxPriorYearProvider = mocks.StrictMock<IMaxPriorYearProvider>(); Expect.Call(warehouseAvailabilityProvider.Get()).Return(suppliedWarehouseAvailability); if (suppliedWarehouseAvailability) { Expect.Call(metricNodeResolver.GetMetricNodeForSchoolFromMetricVariantId(-1, -1)).IgnoreArguments().Return(GetMetricMetadataNode()); Expect.Call(localEducationAgencyContextProvider.GetCurrentLocalEducationAgencyCode()).Return("Code"); Expect.Call(codeIdProvider.Get("Code")).Return(1); Expect.Call(maxPriorYearProvider.Get(1)).Return(2012); Expect.Call(schoolMetricInstanceTeacherListRepository.GetAll()).Return(GetSuppliedSchoolMetricInstanceTeacherList()); Expect.Call(uniqueListProvider.GetUniqueId(suppliedMetricVariantId)).Return(suppliedUniqueId); if (isStaffCountGreaterThanZero) { Expect.Call(staffEdOrgRepository.GetAll()).Return(GetSuppliedStaffEdOrg()); Expect.Call(staffInformationRepository.GetAll()).Return(GetStaffInformation()); Expect.Call(staffLinks.Default(-1, -1, string.Empty, null, null, null)).IgnoreArguments().Return(string.Empty); } } base.EstablishContext(); }
protected override void EstablishContext() { schoolMetricHistoricalRepository = mocks.StrictMock<IRepository<SchoolMetricHistorical>>(); metricGoalProvider = mocks.StrictMock<IMetricGoalProvider>(); metricStateProvider = mocks.StrictMock<IMetricStateProvider>(); metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<SchoolMetricInstanceSetRequest>>(); trendRenderingDispositionProvider = mocks.StrictMock<ITrendRenderingDispositionProvider>(); metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>(); warehouseAvailabilityProvider = mocks.StrictMock<IWarehouseAvailabilityProvider>(); suppliedSchoolMetricHistorical = GetSuppliedSchoolMetricHistorical(); Expect.Call(warehouseAvailabilityProvider.Get()).Return(true); Expect.Call(metricNodeResolver.GetMetricNodeForSchoolFromMetricVariantId(schoolId1, metricVariantId1)).Return(GetSuppliedMetricMetadataNode()); Expect.Call(schoolMetricHistoricalRepository.GetAll()).Repeat.Any().Return(suppliedSchoolMetricHistorical); Expect.Call(metricGoalProvider.GetMetricGoal(suppliedSchoolMetricInstanceSetKey1, metricId1)).Return(schoolGoal1); //This is tested elsewhere so we ignore and return a fixed value. Expect.Call(metricStateProvider.GetState(1, ".0", "System.IgnoreThisParam")).IgnoreArguments().Repeat.Any(). Return(new State(MetricStateType.Good, "Good")); Expect.Call( metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null)) .Constraints( new ActionConstraint<SchoolMetricInstanceSetRequest>(x => { Assert.That(x.SchoolId == schoolId1); Assert.That(x.MetricVariantId == metricVariantId1); }) ). Return(suppliedSchoolMetricInstanceSetKey1); Expect.Call(trendRenderingDispositionProvider.GetTrendRenderingDisposition(TrendDirection.Decreasing, TrendInterpretation.Standard)).IgnoreArguments().Repeat.Any().Return(TrendEvaluation.UpNoOpinion); }
protected override void EstablishContext() { SetSuppliedGoal(); localEducationAgencyMetricSchoolListRepository = mocks.StrictMock<IRepository<LocalEducationAgencyMetricInstanceSchoolList>>(); schoolInformationRepository = mocks.StrictMock<IRepository<SchoolInformation>>(); uniqueListIdProvider = mocks.StrictMock<IUniqueListIdProvider>(); metricCorrelationService = mocks.StrictMock<IMetricCorrelationProvider>(); metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<LocalEducationAgencyMetricInstanceSetRequest>>(); metricGoalProvider = mocks.StrictMock<IMetricGoalProvider>(); metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>(); warehouseAvailabilityProvider = mocks.StrictMock<IWarehouseAvailabilityProvider>(); maxPriorYearProvider = mocks.StrictMock<IMaxPriorYearProvider>(); suppliedLocalEducationAgencyMetricSchoolList = GetSuppliedLocalEducationAgencyMetricSchoolList(); suppliedSchoolInformationList = GetSuppliedSchoolInformationRepository(); Expect.Call(warehouseAvailabilityProvider.Get()).Return(true); Expect.Call(maxPriorYearProvider.Get(suppliedLocalEducationAgencyId)).Return(2011); Expect.Call(metricNodeResolver.GetMetricNodeForLocalEducationAgencyMetricVariantId(suppliedMetricVariantId)).Return(GetSuppliedMetricMetadataNode()); Expect.Call(localEducationAgencyMetricSchoolListRepository.GetAll()).Repeat.Any().Return(suppliedLocalEducationAgencyMetricSchoolList); Expect.Call(schoolInformationRepository.GetAll()).Return(suppliedSchoolInformationList); Expect.Call(uniqueListIdProvider.GetUniqueId(suppliedMetricVariantId)).Return(suppliedListContext); Expect.Call(metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null)).Constraints( new ActionConstraint<LocalEducationAgencyMetricInstanceSetRequest>(x => { Assert.That(x.MetricVariantId == suppliedMetricVariantId); Assert.That(x.LocalEducationAgencyId == suppliedLocalEducationAgencyId); })).Return(suppliedMetricInstanceSetKey); Expect.Call(metricGoalProvider.GetMetricGoal(suppliedMetricInstanceSetKey, suppliedMetricId)).Return(suppliedGoal); Expect.Call(metricCorrelationService.GetRenderingParentMetricVariantIdForSchool(suppliedMetricVariantId, 1)).Constraints( Rhino.Mocks.Constraints.Is.Equal(suppliedMetricVariantId), Rhino.Mocks.Constraints.Is.Anything()).Repeat.Any().Return(new MetricCorrelationProvider.MetricRenderingContext { ContextMetricVariantId = suppliedContextMetricVariantId, MetricVariantId = suppliedCorrelationMetricVariantId }); }
protected override void EstablishContext() { repository = mocks.StrictMock<IRepository<EdFi.Dashboards.Application.Data.Entities.LocalEducationAgency>>(); Expect.Call(repository.GetAll()).Return(GetLocalEducationAgency()); resolutionService = new RouteValueResolutionService(repository); }
public RecoveryController( IRepository<Post> postRepository, IRepository<Redirect> redirectRepository, IRepository<BlogTemplate> styleRepository, IRepository<User> userRepository, IRepository<Securable> securableRepository, IRepository<TemporaryUploadedBlogBackup> tempBlogBackupRepo, IRepository<Data.Blog> blogRepository, ISecurityHelper securityHelper, IHttpContextService httpContext) : base(blogRepository, httpContext, securityHelper, userRepository, securableRepository) { _postRepository = postRepository; _redirectRepository = redirectRepository; _styleRepository = styleRepository; _tempBlogBackupRepo = tempBlogBackupRepo; _userRepository = userRepository; _blogRepository = blogRepository; _securityHelper = securityHelper; //Naieve clean of the collection to avoid leaks in long running instances of the application var toDelete = _tempBlogBackupRepo.GetAll().Where(b => b.UploadTime < DateTime.Now.AddHours(-1)).ToArray(); foreach(var toDel in toDelete) { _tempBlogBackupRepo.Delete(toDel); } }
protected override void EstablishContext() { //Prepare supplied data collections suppliedStudentMetricBenchmarkAssessmentData = GetSuppliedStudentMetricBenchmarkAssessment(); suppliedSchoolGoal = GetSuppliedMetricGoal(); suppliedMetricState = GetSuppliedMetricState(); //Set up the mocks metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>(); studentMetricBenchmarkAssessmentRepository = mocks.StrictMock<IRepository<StudentMetricBenchmarkAssessment>>(); metricGoalProvider = mocks.StrictMock<IMetricGoalProvider>(); metricStateProvider = mocks.StrictMock<IMetricStateProvider>(); metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<StudentSchoolMetricInstanceSetRequest>>(); //Set expectations Expect.Call(metricNodeResolver.GetMetricNodeForStudentFromMetricVariantId(suppliedSchoolId, suppliedMetricVariantId)).Return(GetMetricMetadataNode()); Expect.Call(studentMetricBenchmarkAssessmentRepository.GetAll()).Return(suppliedStudentMetricBenchmarkAssessmentData); Expect.Call( metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null)) .Constraints( new ActionConstraint<StudentSchoolMetricInstanceSetRequest>(x => { Assert.That(x.SchoolId == suppliedSchoolId); Assert.That(x.MetricVariantId == suppliedMetricVariantId); Assert.That(x.StudentUSI == suppliedStudentUSI); }) ).Return(suppliedMetricInstanceSetKey); Expect.Call(metricGoalProvider.GetMetricGoal(suppliedMetricInstanceSetKey, suppliedMetricId)).Return(suppliedSchoolGoal); Expect.Call(metricStateProvider.GetState(suppliedMetricId, suppliedMetricValueStr, "System.Double")).Repeat.Any().Return(suppliedMetricState); Expect.Call(metricStateProvider.GetState(suppliedMetricId, "", "System.Double")).Return(suppliedMetricState); }
public DashboardViewModel( IRepository<ClassModel> repository) { _repository = repository; Title = "My window"; Classes = new ObservableCollection<ClassModel>(_repository.GetAll().Result); }
public void Add_InBatchMode_Should_Delay_The_Action(IRepository<Contact, string> repository) { using (var batch = repository.BeginBatch()) { batch.Add(new Contact { Name = "Test User 1" }); repository.GetAll().Count().ShouldEqual(0); // shouldn't have really been added yet batch.Add(new Contact { Name = "Test User 2" }); repository.GetAll().Count().ShouldEqual(0); // shouldn't have really been added yet batch.Commit(); } repository.GetAll().Count().ShouldEqual(2); }
protected override void EstablishContext() { repository = mocks.StrictMock<IRepository<LocalEducationAgencyInformation>>(); suppliedLocalEducationAgencyInformation = GetSuppliedLocalEducationAgencyData(); Expect.Call(repository.GetAll()).Return(suppliedLocalEducationAgencyInformation); }
protected override void EstablishContext() { base.EstablishContext(); suppliedData = GetData(); repository = mocks.StrictMock<IRepository<StudentMetricAbsencesByClass>>(); Expect.Call(repository.GetAll()).Return(suppliedData); }
public void Delete_Should_Remove_Multiple_Items(IRepository<Contact, string> repository) { IList<Contact> contacts = new List<Contact> { new Contact {Name = "Contact 1"}, new Contact {Name = "Contact 2"}, new Contact {Name = "Contact 3"}, }; repository.Add(contacts); var items = repository.GetAll().ToList(); items.Count().ShouldEqual(3); repository.Delete(contacts.Take(2)); items = repository.GetAll().ToList(); items.Count().ShouldEqual(1); items.First().Name.ShouldEqual("Contact 3"); }
public void Delete_Predicate_Should_Remove_Multiple_Items(IRepository<Contact, string> repository) { IList<Contact> contacts = new List<Contact> { new Contact {Name = "Contact 1", ContactTypeId = 1}, new Contact {Name = "Contact 2", ContactTypeId = 1}, new Contact {Name = "Contact 3", ContactTypeId = 3}, }; repository.Add(contacts); var items = repository.GetAll().ToList(); items.Count().ShouldEqual(3); repository.Delete(x => x.ContactTypeId < 3); items = repository.GetAll().ToList(); items.Count().ShouldEqual(1); items.First().Name.ShouldEqual("Contact 3"); }
protected override void EstablishContext() { base.EstablishContext(); repository = mocks.StrictMock<IRepository<StudentMetricLearningObjective>>(); metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>(); Expect.Call(metricNodeResolver.GetMetricNodeForStudentFromMetricVariantId(suppliedSchoolId, suppliedMetricVariantId)).Return(GetMetricMetadataNode()); Expect.Call(repository.GetAll()).Return(GetData()); }
protected override void EstablishContext() { suppliedMetricInstanceSetKey_ForWantedData = new Guid("56cff024-f54a-4a7f-89c2-5af94a4660da"); suppliedMetricInstanceSetKey_ForNOTWantedData_0 = new Guid("26A3CB30-F849-4C57-A7EA-D600D409E687"); suppliedMetricInstanceSetKey_ForNOTWantedData_1 = new Guid("FD473AB7-BF77-48D8-ADA1-B3CBC2DF5D44"); metricComponentRepository = mocks.StrictMock<IRepository<MetricComponent>>(); Expect.Call(metricComponentRepository.GetAll()).Return(GetSuppliedMetricComponentData()); }
public static bool HasStudents(IRepository<StaffStudentAssociation> staffStudentAssociationRepository, AssociatedSchool associatedSchool, UserInformation userInformation) { var staffStudenAssociation = (from ssa in staffStudentAssociationRepository.GetAll() where ssa.StaffUSI == userInformation.StaffUSI && ssa.SchoolId == associatedSchool.SchoolId select ssa).FirstOrDefault(); return staffStudenAssociation != null; }
protected override void EstablishContext() { base.EstablishContext(); suppliedData = GetData(); repository = mocks.StrictMock<IRepository<StudentMetricLearningStandard>>(); metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>(); Expect.Call(metricNodeResolver.ResolveMetricId(suppliedMetricId)).Return(suppliedMetricId); Expect.Call(repository.GetAll()).Return(suppliedData); }
public void Delete_By_Params_Should_Remove_Multiple_Items(IRepository<Contact, string> repository) { var contact1 = new Contact {Name = "Contact 1", ContactTypeId = 1}; var contact2 = new Contact {Name = "Contact 2", ContactTypeId = 1}; var contact3 = new Contact {Name = "Contact 3", ContactTypeId = 3}; repository.Add(contact1); repository.Add(contact2); repository.Add(contact3); var items = repository.GetAll().ToList(); items.Count().ShouldEqual(3); repository.Delete(contact1.ContactId, contact2.ContactId); items = repository.GetAll().ToList(); items.Count().ShouldEqual(1); items.First().Name.ShouldEqual("Contact 3"); }
public IEnumerable<Employee> GetAll() => (_secretaryRepository.GetAll() as List<Employee>) .Concat(_doctorRepository.GetAll() as List<Employee>);
public List <ProfileActivityLog> GetAll() { return(_ProfileActivityLogRepository.GetAll().ToList()); }
public ListResultOutput <CustomeFieldSetupListDto> GetCustomeFieldSetup() { var customefieldsetups = _customefieldsetupRepository.GetAll().ToList(); return(new ListResultOutput <CustomeFieldSetupListDto>(customefieldsetups.MapTo <List <CustomeFieldSetupListDto> >())); }
public IEnumerable <EntityFramework.Impact> GetAllImpacts() { var impactRecords = _ImpactRecords.GetAll(); return(impactRecords); }
public List <Item> GetAllItems() { _log.LogError("Get All Items Failed"); return(_repository.GetAll <Item>()); }
public IEnumerable <TicketDTO> GetEntities() { return(mapper.Map <IEnumerable <Ticket>, List <TicketDTO> >(ticketRepository.GetAll())); }
public virtual IEnumerable <TEntity> GetAll() { return(_repository.GetAll()); }
public async Task <List <Image> > Get() { return(await repository.GetAll()); }
public IEnumerable <Property> GetAllProperties() { var propertyRecords = _PropertyRecords.GetAll(); return(propertyRecords); }
public IEnumerable <BusinessObject> Get() { return(_repository.GetAll()); }
public async Task <User> Handle(GetUserByEmailQuery request, CancellationToken cancellationToken) { return(await _repository.GetAll().FirstOrDefaultAsync(x => x.EmailAddress == request.Email)); }
List <Post> IPostService.GetPosts() { return(_postRepository.GetAll().OrderBy(x => x.Id).ToList()); }
public IList <Category> GetAll() { return(categoryRepository.GetAll()); }
public IEnumerable <Client> Get() { return(_clientRepository.GetAll()); }
public IViewComponentResult Invoke(int a) { var count = _repository.GetAll().Count().ToString(); return(View("Default", count)); }
public ActionResult Details(long tid) { //var stopWatch = System.Diagnostics.Stopwatch.StartNew(); try { //tid = 47; if (_viewModel == null) { _viewModel = new TeacherSubscriptionViewModel(); } Model.Model.Teacher teacher = _da.GetModelBy <Model.Model.Teacher, TEACHER>(x => x.Person_Id == tid); if ((teacher != null && teacher.Person.Id > 0) && _viewModel.PersonAlreadyExist == false) { _viewModel.Teacher = teacher; _viewModel.Periods = _da.GetAll <Period, PERIOD>(); _viewModel.WeekDays = _da.GetAll <WeekDay, WEEK_DAY>(); _viewModel.StudentCategories = _da.GetAll <StudentCategory, STUDENT_CATEGORY>(); List <TeacherOLevelResultDetail> firstSittingOLevelResultDetails = null; List <TeacherOLevelResultDetail> secondSittingOLevelResultDetails = null; Referee referee = _da.GetModelBy <Referee, TEACHER_REFEREE>(x => x.Person_Id == _viewModel.Teacher.Person.Id); LoginDetail loginDetail = _da.GetModelBy <LoginDetail, PERSON_LOGIN>(x => x.Person_Id == _viewModel.Teacher.Person.Id); TeacherOLevelResult firstSittingOLevelResult = _da.GetModelBy <TeacherOLevelResult, TEACHER_O_LEVEL_RESULT>(x => x.Person_Id == _viewModel.Teacher.Person.Id && x.O_Level_Exam_Sitting_Id == 1); TeacherOLevelResult secondSittingOLevelResult = _da.GetModelBy <TeacherOLevelResult, TEACHER_O_LEVEL_RESULT>(x => x.Person_Id == _viewModel.Teacher.Person.Id && x.O_Level_Exam_Sitting_Id == 2); List <TeacherEducationalQualification> teacherEducationalQualifications = _da.GetModelsBy <TeacherEducationalQualification, TEACHER_EDUCATIONAL_QUALIFICATION>(x => x.Person_Id == _viewModel.Teacher.Person.Id); List <TeacherEmploymentHistory> teacherEmploymentHistories = _da.GetModelsBy <TeacherEmploymentHistory, TEACHER_EMPLOYMENT_HISTORY>(x => x.Person_Id == _viewModel.Teacher.Person.Id); List <TeacherAward> teacherAwards = _da.GetModelsBy <TeacherAward, TEACHER_AWARD>(x => x.Person_Id == _viewModel.Teacher.Person.Id); List <TeacherStudentCategory> teacherStudentCategories = _da.GetModelsBy <TeacherStudentCategory, TEACHER_STUDENT_CATEGORY>(x => x.Person_Id == _viewModel.Teacher.Person.Id); List <TeacherAvailability> teacherAvailabilities = _da.GetModelsBy <TeacherAvailability, TEACHER_AVAILABILITY>(x => x.Person_Id == _viewModel.Teacher.Person.Id); //_viewModel.Periods = await _da.GetAllAsync<Period, PERIOD>(); //_viewModel.WeekDays = await _da.GetAllAsync<WeekDay, WEEK_DAY>(); //_viewModel.StudentCategories = await _da.GetAllAsync<StudentCategory, STUDENT_CATEGORY>(); //List<TeacherOLevelResultDetail> firstSittingOLevelResultDetails = null; //List<TeacherOLevelResultDetail> secondSittingOLevelResultDetails = null; //Referee referee = await _da.GetModelByAsync<Referee, TEACHER_REFEREE>(x => x.Person_Id == _viewModel.Teacher.Person.Id); //LoginDetail loginDetail = await _da.GetModelByAsync<LoginDetail, PERSON_LOGIN>(x => x.Person_Id == _viewModel.Teacher.Person.Id); //TeacherOLevelResult firstSittingOLevelResult = await _da.GetModelByAsync<TeacherOLevelResult, TEACHER_O_LEVEL_RESULT>(x => x.Person_Id == _viewModel.Teacher.Person.Id && x.O_Level_Exam_Sitting_Id == 1); //TeacherOLevelResult secondSittingOLevelResult = await _da.GetModelByAsync<TeacherOLevelResult, TEACHER_O_LEVEL_RESULT>(x => x.Person_Id == _viewModel.Teacher.Person.Id && x.O_Level_Exam_Sitting_Id == 2); //List<TeacherEducationalQualification> teacherEducationalQualifications = await _da.GetModelsByAsync<TeacherEducationalQualification, TEACHER_EDUCATIONAL_QUALIFICATION>(x => x.Person_Id == _viewModel.Teacher.Person.Id); //List<TeacherEmploymentHistory> teacherEmploymentHistories = await _da.GetModelsByAsync<TeacherEmploymentHistory, TEACHER_EMPLOYMENT_HISTORY>(x => x.Person_Id == _viewModel.Teacher.Person.Id); //List<TeacherAward> teacherAwards = await _da.GetModelsByAsync<TeacherAward, TEACHER_AWARD>(x => x.Person_Id == _viewModel.Teacher.Person.Id); //List<TeacherStudentCategory> teacherStudentCategories = await _da.GetModelsByAsync<TeacherStudentCategory, TEACHER_STUDENT_CATEGORY>(x => x.Person_Id == _viewModel.Teacher.Person.Id); //List<TeacherAvailability> teacherAvailabilities = await _da.GetModelsByAsync<TeacherAvailability, TEACHER_AVAILABILITY>(x => x.Person_Id == _viewModel.Teacher.Person.Id); if (referee != null) { _viewModel.Referee = referee; } if (loginDetail != null) { _viewModel.Teacher.LoginDetail = loginDetail; } else { _viewModel.Teacher.LoginDetail = new LoginDetail(); _viewModel.Teacher.LoginDetail.SecurityQuestion = new SecurityQuestion(); _viewModel.Teacher.LoginDetail.Role = new Role(); } if (_viewModel.Periods != null && _viewModel.Periods.Count > 0) { _viewModel.WeekDays.Insert(0, new WeekDay()); } if (_viewModel.WeekDays != null && _viewModel.WeekDays.Count > 0) { _viewModel.Periods.Insert(0, new Period()); } _viewModel.TeacherStudentCategories = UiUtility.InitializeStudentCategory(_viewModel.StudentCategories); _viewModel.TeacherAvailabilities = UiUtility.InitializeAvailability(_viewModel.WeekDays, _viewModel.Periods); if (teacherEducationalQualifications != null && teacherEducationalQualifications.Count > 0) { if (_viewModel.TeacherEducationalQualifications != null && _viewModel.TeacherEducationalQualifications.Count > 0) { foreach (TeacherEducationalQualification educationalQualification in teacherEducationalQualifications) { foreach (TeacherEducationalQualification qualification in _viewModel.TeacherEducationalQualifications) { if (qualification.SchoolType.Id == educationalQualification.SchoolType.Id && qualification.Id <= 0) { qualification.Id = educationalQualification.Id; qualification.Person = educationalQualification.Person; qualification.SchoolType = educationalQualification.SchoolType; qualification.School = educationalQualification.School; qualification.YearOfAdmission = educationalQualification.YearOfAdmission; qualification.YearOfGraduation = educationalQualification.YearOfGraduation; qualification.Qualification = educationalQualification.Qualification; break; } } } } } if (firstSittingOLevelResult != null && firstSittingOLevelResult.Id > 0) { firstSittingOLevelResultDetails = _da.GetModelsBy <TeacherOLevelResultDetail, TEACHER_O_LEVEL_RESULT_DETAIL>(x => x.Teacher_O_Level_Result_Id == firstSittingOLevelResult.Id); } if (secondSittingOLevelResult != null && secondSittingOLevelResult.Id > 0) { secondSittingOLevelResultDetails = _da.GetModelsBy <TeacherOLevelResultDetail, TEACHER_O_LEVEL_RESULT_DETAIL>(x => x.Teacher_O_Level_Result_Id == secondSittingOLevelResult.Id); } if (teacherEmploymentHistories != null && teacherEmploymentHistories.Count > 0) { if (_viewModel.TeacherEmploymentHistories != null && _viewModel.TeacherEmploymentHistories.Count > 0) { for (int i = 0; i < teacherEmploymentHistories.Count; i++) { _viewModel.TeacherEmploymentHistories[i].Id = teacherEmploymentHistories[i].Id; _viewModel.TeacherEmploymentHistories[i].Person = teacherEmploymentHistories[i].Person; _viewModel.TeacherEmploymentHistories[i].Employer = teacherEmploymentHistories[i].Employer; _viewModel.TeacherEmploymentHistories[i].LastPositionHeld = teacherEmploymentHistories[i].LastPositionHeld; _viewModel.TeacherEmploymentHistories[i].StartYear = teacherEmploymentHistories[i].StartYear; _viewModel.TeacherEmploymentHistories[i].EndYear = teacherEmploymentHistories[i].EndYear; } } } if (teacherAwards != null && teacherAwards.Count > 0) { if (_viewModel.TeacherAwards != null && _viewModel.TeacherAwards.Count > 0) { for (int i = 0; i < teacherAwards.Count; i++) { _viewModel.TeacherAwards[i].Id = teacherAwards[i].Id; _viewModel.TeacherAwards[i].Person = teacherAwards[i].Person; _viewModel.TeacherAwards[i].AwardBody = teacherAwards[i].AwardBody; _viewModel.TeacherAwards[i].AwardName = teacherAwards[i].AwardName; _viewModel.TeacherAwards[i].YearAwarded = teacherAwards[i].YearAwarded; } } } if (teacherStudentCategories != null && teacherStudentCategories.Count > 0) { if (_viewModel.TeacherStudentCategories != null && _viewModel.TeacherStudentCategories.Count > 0) { foreach (TeacherStudentCategory teacherStudentCategory in _viewModel.TeacherStudentCategories) { List <TeacherStudentCategory> studentCategories = teacherStudentCategories.Where(x => x.StudentCategory.Id == teacherStudentCategory.StudentCategory.Id).ToList(); if (studentCategories != null && studentCategories.Count > 0) { teacherStudentCategory.IsSelected = true; teacherStudentCategory.Person = _viewModel.Teacher.Person; } } } } if (teacherAvailabilities != null && teacherAvailabilities.Count > 0) { if (_viewModel.TeacherAvailabilities != null && _viewModel.TeacherAvailabilities.Count > 0) { foreach (TeacherAvailability teacherAvailability in _viewModel.TeacherAvailabilities) { List <TeacherAvailability> availabilities = teacherAvailabilities.Where(x => x.WeekDay.Id == teacherAvailability.WeekDay.Id && x.Period.Id == teacherAvailability.Period.Id).ToList(); if (availabilities != null && availabilities.Count > 0) { teacherAvailability.IsAvailable = true; teacherAvailability.Person = _viewModel.Teacher.Person; } } } } SetTeacherFirstSittingOLevelResult(firstSittingOLevelResult, firstSittingOLevelResultDetails); SetTeacherSecondSittingOLevelResult(secondSittingOLevelResult, secondSittingOLevelResultDetails); } SetPassportUrl(_viewModel.Teacher.ImageFileUrl); } catch (Exception ex) { _logger.LogError(ex); SetMessage(ex.Message, ApplicationMessage.Category.Error); } //stopWatch.Stop(); //var executionTime = stopWatch.ElapsedMilliseconds; //ViewBag.Time = executionTime; return(View(_viewModel)); }
public Task <Player[]> GetAll() { return(repository.GetAll()); }
public List <M> GetAll() { return(_repository.GetAll().Select(_mapper.Map <T, M>).ToList()); }
public IActionResult Get() { var customers = _customerRepository.GetAll().Take(10); return(Ok(customers.ToArray())); }
public async Task <PagedResultDto <GetQuotationForViewDto> > GetAll(GetAllQuotationsInput input) { var filteredQuotations = _quotationRepository.GetAll() .Include(e => e.ClientFk) .Include(e => e.ProductCategoryFk) .Include(e => e.PaymentTermFk) .Include(e => e.PriceValidityFk) .WhereIf(!string.IsNullOrWhiteSpace(input.Filter), e => false || e.QuotationNumber.Contains(input.Filter) || e.ShipmentTypes.Contains(input.Filter) || e.DiscountInPercent.Contains(input.Filter) || e.DiscountInAmount.Contains(input.Filter) || e.PlaceOfDelivery.Contains(input.Filter) || e.Status.Contains(input.Filter) || e.CheckedBy.Contains(input.Filter) || e.ApprovedBy.Contains(input.Filter)) .WhereIf(!string.IsNullOrWhiteSpace(input.QuotationNumberFilter), e => e.QuotationNumber.ToLower() == input.QuotationNumberFilter.ToLower().Trim()) .WhereIf(!string.IsNullOrWhiteSpace(input.ShipmentTypesFilter), e => e.ShipmentTypes.ToLower() == input.ShipmentTypesFilter.ToLower().Trim()) .WhereIf(!string.IsNullOrWhiteSpace(input.DiscountInPercentFilter), e => e.DiscountInPercent.ToLower() == input.DiscountInPercentFilter.ToLower().Trim()) .WhereIf(!string.IsNullOrWhiteSpace(input.DiscountInAmountFilter), e => e.DiscountInAmount.ToLower() == input.DiscountInAmountFilter.ToLower().Trim()) .WhereIf(!string.IsNullOrWhiteSpace(input.PlaceOfDeliveryFilter), e => e.PlaceOfDelivery.ToLower() == input.PlaceOfDeliveryFilter.ToLower().Trim()) .WhereIf(!string.IsNullOrWhiteSpace(input.StatusFilter), e => e.Status.ToLower() == input.StatusFilter.ToLower().Trim()) .WhereIf(!string.IsNullOrWhiteSpace(input.CheckedByFilter), e => e.CheckedBy.ToLower() == input.CheckedByFilter.ToLower().Trim()) .WhereIf(!string.IsNullOrWhiteSpace(input.ApprovedByFilter), e => e.ApprovedBy.ToLower() == input.ApprovedByFilter.ToLower().Trim()) .WhereIf(!string.IsNullOrWhiteSpace(input.ClientClientNameFilter), e => e.ClientFk != null && e.ClientFk.ClientName.ToLower() == input.ClientClientNameFilter.ToLower().Trim()) .WhereIf(!string.IsNullOrWhiteSpace(input.ProductCategoryMaterialFilter), e => e.ProductCategoryFk != null && e.ProductCategoryFk.Material.ToLower() == input.ProductCategoryMaterialFilter.ToLower().Trim()) .WhereIf(!string.IsNullOrWhiteSpace(input.PaymentTermDescriptionFilter), e => e.PaymentTermFk != null && e.PaymentTermFk.Description.ToLower() == input.PaymentTermDescriptionFilter.ToLower().Trim()) .WhereIf(!string.IsNullOrWhiteSpace(input.PriceValidityDescriptionFilter), e => e.PriceValidityFk != null && e.PriceValidityFk.Description.ToLower() == input.PriceValidityDescriptionFilter.ToLower().Trim()); var pagedAndFilteredQuotations = filteredQuotations .OrderBy(input.Sorting ?? "id asc") .PageBy(input); var quotations = from o in pagedAndFilteredQuotations join o1 in _lookup_clientRepository.GetAll() on o.ClientId equals o1.Id into j1 from s1 in j1.DefaultIfEmpty() join o2 in _lookup_productCategoryRepository.GetAll() on o.ProductCategoryId equals o2.Id into j2 from s2 in j2.DefaultIfEmpty() join o3 in _lookup_paymentTermRepository.GetAll() on o.PaymentTermId equals o3.Id into j3 from s3 in j3.DefaultIfEmpty() join o4 in _lookup_priceValidityRepository.GetAll() on o.PriceValidityId equals o4.Id into j4 from s4 in j4.DefaultIfEmpty() select new GetQuotationForViewDto() { Quotation = new QuotationDto { QuotationNumber = o.QuotationNumber, ShipmentTypes = o.ShipmentTypes, DiscountInPercent = o.DiscountInPercent, DiscountInAmount = o.DiscountInAmount, PlaceOfDelivery = o.PlaceOfDelivery, Status = o.Status, CheckedBy = o.CheckedBy, ApprovedBy = o.ApprovedBy, Id = o.Id }, ClientClientName = s1 == null ? "" : s1.ClientName.ToString(), ProductCategoryMaterial = s2 == null ? "" : s2.Material.ToString(), PaymentTermDescription = s3 == null ? "" : s3.Description.ToString(), PriceValidityDescription = s4 == null ? "" : s4.Description.ToString() }; var totalCount = await filteredQuotations.CountAsync(); return(new PagedResultDto <GetQuotationForViewDto>( totalCount, await quotations.ToListAsync() )); }
public IEnumerable <PictureVO> GetAll() { return(_repository.GetAll()); }
public IEnumerable <Response> GetAll(Request request) => repository.GetAll(request);
public IEnumerable <DemoRecord> Get() => _repository.GetAll();
private bool NoDuplication(AssetModel model) { var asset = _assetRepository.GetAll().Where(c => c.Name == model.Name && c.SiteId == model.SiteId && c.Id != model.Id).FirstOrDefault(); return(asset == null); }
public IEnumerable <Position> Get() { return(positionRepo.GetAll()); }
private List <RisultatoRicerca> Cerca(Ruolo ruolo, bool filtraRuoliNonValidi) { List <RisultatoRicerca> risultati = new List <RisultatoRicerca>(); try { IEnumerable <Dipendente> dipendenti = _dipendentiRepos.GetAll(); //Per ogni figura mi calcolo gli indici foreach (var dipendente in dipendenti) { bool valido = true; //Sto cercando ruolo CAPO, devo scartare i dipendenti che sono già DIRETTORI if (filtraRuoliNonValidi) { valido = Filtri.ValidaA_MinoriUgualiDi_B(dipendente.RuoloInAzienda, ruolo); } if (valido) { RisultatoRicerca risultato = new RisultatoRicerca(); risultato.Nome = string.Format("#{0} - {1} {2} - {3}", dipendente.Matricola, dipendente.Cognome, dipendente.Nome, dipendente.RuoloInAzienda != null ? dipendente.RuoloInAzienda.Titolo : ""); risultato.Id = dipendente.Id; risultato.PMAX_HrDiscrezionali = _parametriConfronto.PMAX_HrDiscrezionali; risultato.PMAX_HrComportamentali = _parametriConfronto.PMAX_HrComportamentali; risultato.PMAX_Comportamentali = _parametriConfronto.PMAX_Comportamentali; risultato.PMAX_TecnStrategicSupport = _parametriConfronto.PMAX_TecnStrategicSupport; risultato.PMAX_TecnCompetitiveAdv = _parametriConfronto.PMAX_TecnCompetitiveAdv; risultato.PERC_SogliaFoundational = _parametriConfronto.PERC_SogliaFoundational; //Devo lavorare su un sottoinsieme delle conoscenze del dipendente List <ConoscenzaCompetenza> competenzeDaConfrontare = new List <ConoscenzaCompetenza>(); //Mi scorro tutte le competenze possedute dal ruolo foreach (var conoscenzaDip in dipendente.Conoscenze) { //Se è una delle competenze che servono per il confronto if (ruolo.Conoscenze.Contains(conoscenzaDip, c => c.CompetenzaId)) { //l'aggiungo alla lista su cui calcolerò il Punteggio Osservato competenzeDaConfrontare.Add(conoscenzaDip); } //Se non è presente è come se avessi inserito la competenza con valore 0 } //Calcolo punteggio osservato (su dipendente) Punteggi po = Common.CalcolaPunteggi(competenzeDaConfrontare); //Calcolo punteggio atteso Punteggi pa = Common.CalcolaPunteggi(ruolo.Conoscenze); //Tutte le percentuali vengono calcolate automaticamente risultato.PunteggioOsservato = po; risultato.PunteggioAtteso = pa; risultati.Add(risultato); } } } catch (Exception fault) { throw fault; } return(risultati); }
public virtual int GetPeopleCount() { //GetAll can be only used inside a UOW. This should work since MyCustomUowClass is UOW by custom convention. unitOfWorkManager.Current.ShouldNotBeNull(); return(personRepository.GetAll().Count()); }
public IEnumerable <Office> GetAll() { return(repository.GetAll()); }
public IEnumerable <Product> GetProducts() { return(ProductRepository.GetAll()); }
public IHttpActionResult getAllProducts() { return(Ok(_productRepository.GetAll())); }