/// <summary> /// Gets all the settings data required for the client. /// </summary> /// <param name="id">Id of the homepage or -1 if global settings.</param> public GigyaSettingsApiResponseModel Get(int id) { var settingsHelper = new Umbraco.Module.v621.Helpers.GigyaSettingsHelper(); var data = settingsHelper.Get(id); var model = GetModel(id, data); var wrappedModel = new GigyaSettingsApiResponseModel { Settings = model, Data = new GigyaConfigModel { Languages = GigyaLanguageHelper.Languages.Select(i => new GigyaLanguageModel { Code = i.Key, Name = i.Value }).ToList() } }; wrappedModel.Data.LanguageOptions = wrappedModel.Data.Languages.ToList(); wrappedModel.Data.LanguageOptions.Insert(0, new GigyaLanguageModel { Code = Core.Constants.Languages.Other, Name = Core.Constants.Languages.Other }); wrappedModel.Data.LanguageOptions.Insert(0, new GigyaLanguageModel { Code = Core.Constants.Languages.Auto, Name = Core.Constants.Languages.AutoName }); return(wrappedModel); }
/// <summary> /// Gets all the settings data required for the client. /// </summary> /// <param name="id">Id of the homepage or -1 if global settings.</param> public GigyaSettingsApiResponseModel Get(int id) { var settingsHelper = new Umbraco.Module.Helpers.GigyaSettingsHelper(); var data = settingsHelper.Get(id); var model = GetModel(id, data); var memberType = this.ApplicationContext.Services.MemberTypeService.Get(Constants.MemberTypeAlias); var wrappedModel = new GigyaSettingsApiResponseModel { Settings = model, Data = new GigyaConfigModel { Languages = GigyaLanguageHelper.Languages.Select(i => new GigyaLanguageModel { Code = i.Key, Name = i.Value }).ToList(), MemberProperties = memberType.PropertyTypes.Select(i => new GigyaMemberPropertyViewModel { Alias = i.Alias, Name = i.Name }).ToList() } }; wrappedModel.Data.LanguageOptions = wrappedModel.Data.Languages.ToList(); wrappedModel.Data.LanguageOptions.Insert(0, new GigyaLanguageModel { Code = Core.Constants.Languages.Other, Name = Core.Constants.Languages.Other }); wrappedModel.Data.LanguageOptions.Insert(0, new GigyaLanguageModel { Code = Core.Constants.Languages.Auto, Name = Core.Constants.Languages.AutoName }); return(wrappedModel); }