public IVmListItem GetLanguageByCode(string code) { var result = new VmListItem(); contextManager.ExecuteReader(unitOfWork => { var rep = unitOfWork.CreateRepository <ILanguageRepository>(); result = translationEntToVm.TranslateFirst <Language, VmListItem>(rep.All().Where(x => x.Code == code.ToLower())); }); return(result); }
public IVmListItem GetMunicipalityByCode(string code, bool onlyValid = false) { var result = new VmListItem(); contextManager.ExecuteReader(unitOfWork => { var rep = unitOfWork.CreateRepository <IMunicipalityRepository>(); var municipalityCodeQry = rep.All().Where(x => x.Code == code); if (onlyValid) { municipalityCodeQry = municipalityCodeQry.Where(m => m.IsValid); } var municipalityCode = municipalityCodeQry.FirstOrDefault(); if (municipalityCode != null) { result = translationEntToVm.Translate <Municipality, VmListItem>(municipalityCode); } }); return(result); }
private static void CheckTranslation(VmListItem source, OrganizationService target) { target.ServiceVersionedId.Should().Be(Guid.Empty); target.OrganizationId.Should().Be(source.Id); }
private void CheckTranslation(VmListItem source, ServiceLifeEvent target) { target.LifeEventId.Should().Be(source.Id); }