コード例 #1
0
        public async Task UpdateAsync(Guid currentScientificInterestsId, ScientificInterestsDto newScientificInterests)
        {
            var scientificInterests = await _domainContext.ScientificInterests.FirstOrDefaultAsync(e => e.Id == currentScientificInterestsId);

            if (scientificInterests != null)
            {
                scientificInterests.NameOfScientificInterests = newScientificInterests.NameOfScientificInterests;
                scientificInterests.EmployeeId = newScientificInterests.EmployeeId;
            }
        }
コード例 #2
0
        public ScientificInterests Add(ScientificInterestsDto addedScientificInterests)
        {
            var scientificInterests = new ScientificInterests()
            {
                NameOfScientificInterests = addedScientificInterests.NameOfScientificInterests,
                EmployeeId = addedScientificInterests.EmployeeId
            };

            _domainContext.ScientificInterests.Add(scientificInterests);
            return(scientificInterests);
        }
コード例 #3
0
        public async Task <ScientificInterests> CreateOrUpdate(Guid?scientificInterestsId, ScientificInterestsDto createdScientificInterestsData)
        {
            if (scientificInterestsId == null)
            {
                var scientificInterests = _scientificInterestsRepository.Add(createdScientificInterestsData);
                await _domainContext.SaveChangesAsync();

                return(await _scientificInterestsRepository.GetAsync(scientificInterests.Id));
            }

            await _scientificInterestsRepository.UpdateAsync(scientificInterestsId.Value, createdScientificInterestsData);

            await _domainContext.SaveChangesAsync();

            return(await _scientificInterestsRepository.GetAsync(scientificInterestsId.Value));
        }