本文整理汇总了C#中IRepository.GetByID方法的典型用法代码示例。如果您正苦于以下问题:C# IRepository.GetByID方法的具体用法?C# IRepository.GetByID怎么用?C# IRepository.GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRepository
的用法示例。
在下文中一共展示了IRepository.GetByID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerformPhotoSaving
private static void PerformPhotoSaving(User destination, UserDTO source, IRepository<File> fileRepository)
{
var photoInDTO = source.Photo;
if (photoInDTO != null)
{
var photoInDb = fileRepository.GetByID(source.Photo.Id);
if (photoInDb == null)
{
throw new Exception("Database doesn't contains such entity");
}
if (photoInDTO.ShouldBeRemoved())
{
fileRepository.Delete(photoInDb.Id);
}
else
{
photoInDb.Update(photoInDTO);
destination.Photo = photoInDb;
}
}
}
示例2: RefreshExistingVacanciesProgress
private static void RefreshExistingVacanciesProgress(Candidate destination, CandidateDTO source, IRepository<VacancyStageInfo> vacancyStageInfoRepository, IRepository<Vacancy> vacancyRepo)
{
source.VacanciesProgress.Where(x => !x.IsNew()).ToList().ForEach(updatedVacanciesStageInfo =>
{
var domainVacancyStageInfo = destination.VacanciesProgress.FirstOrDefault(x => x.Id == updatedVacanciesStageInfo.Id);
if (domainVacancyStageInfo == null)
{
throw new ArgumentNullException("You trying to update vacancy stage info which is actually doesn't exists in database");
}
if (updatedVacanciesStageInfo.ShouldBeRemoved())
{
vacancyStageInfoRepository.Delete(updatedVacanciesStageInfo.Id);
}
else
{
domainVacancyStageInfo.Update(vacancyRepo.GetByID(domainVacancyStageInfo.VacancyId), updatedVacanciesStageInfo);
}
});
}
示例3: PerformTagsSaving
private static void PerformTagsSaving(Candidate destination, CandidateDTO source, IRepository<Tag> tagRepository)
{
destination.Tags.Clear();
source.TagIds.ToList().ForEach(tagId =>
{
destination.Tags.Add(tagRepository.GetByID(tagId));
});
}
示例4: PerformSkillsSaving
private static void PerformSkillsSaving(Candidate destination, CandidateDTO source, IRepository<Skill> skillRepository)
{
destination.Skills.Clear();
source.SkillIds.ToList().ForEach(skillId =>
{
destination.Skills.Add(skillRepository.GetByID(skillId));
});
}
示例5: PerformFilesSaving
private static void PerformFilesSaving(Candidate destination, CandidateDTO source, IRepository<File> fileRepository)
{
source.Files.ToList().ForEach(file =>
{
var fileInCandidate = destination.Files.FirstOrDefault(x => x.Id == file.Id);
var dbFile = fileRepository.GetByID(file.Id);
if (dbFile == null)
{
throw new Exception("Database doesn't contains such entity");
}
if (file.ShouldBeRemoved())
{
fileRepository.Delete(file.Id);
}
else
{
dbFile.Update(file);
if (fileInCandidate == null)
{
destination.Files.Add(dbFile);
}
}
});
}
示例6: CreateNewVacanciesProgress
private static void CreateNewVacanciesProgress(Candidate destination, CandidateDTO source, IRepository<Vacancy> vacancyRepo)
{
source.VacanciesProgress.Where(x => x.IsNew()).ToList().ForEach(newVacancyStageInfo =>
{
var toDomain = new VacancyStageInfo();
toDomain.Update(vacancyRepo.GetByID(newVacancyStageInfo.VacancyId.Value), newVacancyStageInfo);
destination.VacanciesProgress.Add(toDomain);
});
}