当前位置: 首页>>代码示例>>C#>>正文


C# IRepository.GetByID方法代码示例

本文整理汇总了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;
         }
     }
 }
开发者ID:kulish-alina,项目名称:HR_Project,代码行数:21,代码来源:UserExtensions.cs

示例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);
         }
     });
 }
开发者ID:kulish-alina,项目名称:HR_Project,代码行数:19,代码来源:CandidateExtensions.cs

示例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));
     });
 }
开发者ID:kulish-alina,项目名称:HR_Project,代码行数:8,代码来源:CandidateExtensions.cs

示例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));
     });
 }
开发者ID:kulish-alina,项目名称:HR_Project,代码行数:8,代码来源:CandidateExtensions.cs

示例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);
             }
         }
     });
 }
开发者ID:kulish-alina,项目名称:HR_Project,代码行数:24,代码来源:CandidateExtensions.cs

示例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);
     });
 }
开发者ID:kulish-alina,项目名称:HR_Project,代码行数:9,代码来源:CandidateExtensions.cs


注:本文中的IRepository.GetByID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。