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; } }
public ScientificInterests Add(ScientificInterestsDto addedScientificInterests) { var scientificInterests = new ScientificInterests() { NameOfScientificInterests = addedScientificInterests.NameOfScientificInterests, EmployeeId = addedScientificInterests.EmployeeId }; _domainContext.ScientificInterests.Add(scientificInterests); return(scientificInterests); }
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)); }