コード例 #1
0
 public IServiceResultWrap GetService([FromBody] VmServiceBasic model)
 {
     return(serviceManager.CallService(
                () => new ServiceResultWrap {
         Data = serviceService.GetService(model)
     },
                new Dictionary <Type, string>()));
 }
コード例 #2
0
        public VmServiceOutput GetService(VmServiceBasic model)
        {
            VmServiceOutput result = null;

            ContextManager.ExecuteReader(unitOfWork =>
            {
                result = GetService(model, unitOfWork);
            });

            return(result);
        }
コード例 #3
0
        private VmServiceOutput GetService(VmServiceBasic model, IUnitOfWork unitOfWork)
        {
            VmServiceOutput result = null;

            SetTranslatorLanguage(model);
            ServiceVersioned entity = null;

            result = GetModel <ServiceVersioned, VmServiceOutput>(entity = GetEntity <ServiceVersioned>(model.Id, unitOfWork,
                                                                                                        q => q.Include(x => x.ServiceNames)
                                                                                                        .Include(x => x.ServiceDescriptions)
                                                                                                        .Include(x => x.OrganizationServices)
                                                                                                        .Include(x => x.ServiceRequirements)
                                                                                                        .Include(x => x.AreaMunicipalities)
                                                                                                        .Include(x => x.Areas).ThenInclude(x => x.Area)
                                                                                                        .Include(x => x.LanguageAvailabilities)
                                                                                                        .Include(x => x.Versioning)
                                                                                                        .Include(x => x.ServiceLanguages)
                                                                                                        .Include(x => x.ServiceKeywords).ThenInclude(x => x.Keyword)
                                                                                                        .Include(x => x.ServiceServiceClasses)                                                           //.ThenInclude(x => x.ServiceClass).ThenInclude(x => x.Names)
                                                                                                        .Include(x => x.ServiceOntologyTerms).ThenInclude(x => x.OntologyTerm).ThenInclude(x => x.Names) // to cache
                                                                                                        .Include(x => x.ServiceLifeEvents).ThenInclude(x => x.LifeEvent).ThenInclude(x => x.Names)       // to cache
                                                                                                        .Include(x => x.ServiceIndustrialClasses)                                                        //.ThenInclude(x => x.IndustrialClass).ThenInclude(x => x.Names)
                                                                                                        .Include(x => x.ServiceTargetGroups)
                                                                                                        .Include(x => x.ServiceWebPages).ThenInclude(x => x.WebPage)
                                                                                                        .Include(x => x.ServiceProducers).ThenInclude(x => x.Organizations)
                                                                                                        .Include(x => x.ServiceProducers).ThenInclude(x => x.AdditionalInformations)
                                                                                                        .Include(x => x.ServiceLaws).ThenInclude(j => j.Law).ThenInclude(k => k.Names)
                                                                                                        .Include(x => x.ServiceLaws).ThenInclude(j => j.Law).ThenInclude(k => k.WebPages)
                                                                                                        .Include(x => x.ServiceLaws).ThenInclude(j => j.Law).ThenInclude(k => k.WebPages).ThenInclude(l => l.WebPage)
                                                                                                        .Include(x => x.UnificRoot).ThenInclude(j => j.ServiceServiceChannels).ThenInclude(j => j.ServiceServiceChannelDescriptions)
                                                                                                        .Include(x => x.UnificRoot).ThenInclude(j => j.ServiceServiceChannels).ThenInclude(j => j.ServiceServiceChannelDigitalAuthorizations).ThenInclude(j => j.DigitalAuthorization)
                                                                                                        .Include(x => x.UnificRoot).ThenInclude(j => j.ServiceServiceChannels).ThenInclude(j => j.ServiceServiceChannelExtraTypes).ThenInclude(j => j.ServiceServiceChannelExtraTypeDescriptions)
                                                                                                        ), unitOfWork);

            AddConnectionsInfo(result, entity.UnificRoot.ServiceServiceChannels, unitOfWork);
            result.PreviousInfo = result.Id.HasValue ? Utilities.CheckIsEntityEditable <ServiceVersioned, Service>(result.Id.Value, unitOfWork) : null;

            if (result.GeneralDescriptionId != null)
            {
                result.GeneralDescriptionOutput =
                    generalDescriptionService.GetGeneralDescription(
                        new VmGeneralDescriptionGet()
                {
                    Id            = result.GeneralDescriptionId,
                    Language      = model.Language,
                    OnlyPublished = true
                }, unitOfWork);

                result.GeneralDescriptionOutput.Id = result.GeneralDescriptionOutput.UnificRootId;
            }
            return(result);
        }