Exemplo n.º 1
0
        public override VmLocationChannelStep1 TranslateEntityToVm(ServiceChannelVersioned entity)
        {
            var phoneTypeId = _typesCache.Get <PhoneNumberType>(PhoneNumberTypeEnum.Phone.ToString());
            var faxTypeId   = _typesCache.Get <PhoneNumberType>(PhoneNumberTypeEnum.Fax.ToString());

            var definition = CreateEntityViewModelDefinition <VmLocationChannelStep1>(entity)
                             .AddSimple(i => i.Id, o => o.Id)
                             .AddSimple(input => input.UnificRootId, outupt => outupt.UnificRootId)
                             .AddSimple(input => input.AreaInformationTypeId, outupt => outupt.AreaInformationTypeId)
                             .AddSimple(input => input.PublishingStatusId, output => output.PublishingStatusId)
                             .AddSimple(input => input.ConnectionTypeId, output => output.ConnectionTypeId)
                             .AddPartial(input => input.ServiceLocationChannels?.FirstOrDefault())
                             .AddCollection <ILanguageAvailability, VmLanguageAvailabilityInfo>(input => input.LanguageAvailabilities, o => o.LanguagesAvailabilities);

            definitionHelper.AddEmailsDefinition(definition, RequestLanguageCode);
            definitionHelper.AddPhonesPhoneTypeDefinition(definition, RequestLanguageCode);
            definitionHelper.AddPhonesFaxTypeDefinition(definition, RequestLanguageCode);
            definitionHelper.AddLanguagesDefinition(definition);
            definitionHelper.AddWebPagesDefinition(definition, RequestLanguageCode);
            definitionHelper.AddAllAreasDefinition(definition);

            return(definitionHelper.AddChannelDescriptionsDefinition(definition).GetFinal());
        }