コード例 #1
0
        public virtual IActionResult ResearcherEducationAdd(int researcherId, int degreeId,
                                                            string educationLevelName, string institudeName, string countryName, int graduationYear)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageResearchers))
            {
                return(AccessDeniedView());
            }

            //try to get a researcher with the specified id
            var researcher = _researcherService.GetResearcherById(researcherId);

            if (researcher == null)
            {
                return(Json(new { Result = false }));
            }

            var researcherEducation = new ResearcherEducation
            {
                ResearcherId       = researcher.Id,
                DegreeId           = degreeId,
                EducationLevelName = educationLevelName,
                InstituteName      = institudeName,
                CountryName        = countryName,
                GraduationYear     = graduationYear
            };

            _researcherService.InsertResearcherEducation(researcherEducation);
            //  researcher.ResearcherEducations.Add(researcherEducation);
            //  _researcherService.UpdateResearcher(researcher);

            return(Json(new { Result = true }));
        }
コード例 #2
0
        /// <summary>
        /// Updates the researcherEducation
        /// </summary>
        /// <param name="researcherEducation">ResearcherEducation</param>
        public virtual void UpdateResearcherEducation(ResearcherEducation researcherEducation)
        {
            if (researcherEducation == null)
            {
                throw new ArgumentNullException(nameof(researcherEducation));
            }

            _researcherEducationRepository.Update(researcherEducation);
        }
コード例 #3
0
        public void RemoveResearcherEducation(Researcher researcher, ResearcherEducation researcherEducation)
        {
            if (researcher == null)
            {
                throw new ArgumentNullException(nameof(researcher));
            }

            if (researcherEducation == null)
            {
                throw new ArgumentNullException(nameof(researcherEducation));
            }

            researcher.ResearcherEducations.Remove(researcherEducation);
            // DeleteResearcherEducation(researcherEducation);
        }
コード例 #4
0
        public void InsertResearcherEducation(ResearcherEducation researcherEducation)
        {
            if (researcherEducation == null)
            {
                throw new ArgumentNullException(nameof(researcherEducation));
            }

            if (researcherEducation is IEntityForCaching)
            {
                throw new ArgumentException("Cacheable entities are not supported by Entity Framework");
            }

            _researcherEducationRepository.Insert(researcherEducation);

            //cache
            //_cacheManager.RemoveByPattern(ResearchResearcherEducationDefaults.ResearcherEducationsPatternCacheKey);
            //_staticCacheManager.RemoveByPattern(ResearchResearcherEducationDefaults.ResearcherEducationsPatternCacheKey);

            ////event notification
            //_eventPublisher.EntityInserted(researcherEducation);
        }