Skip to content

Commit

Permalink
Sync culture retrieval across branches.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Lenoch committed Jul 29, 2019
1 parent 49fda54 commit 7ebd6f7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
13 changes: 11 additions & 2 deletions Business/Dto/Culture/CultureDto.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
namespace Business.Dto.Culture
using System;

namespace Business.Dto.Culture
{
/// <summary>
/// A lightweight representation of Kentico's <see cref="CMS.SiteProvider.CultureSiteInfo"/> objects.
/// </summary>
public class CultureDto : IDto
{
public Guid CultureGuid { get; set; }

public string CultureCode { get; set; }

public string CultureName { get; set; }

public string CultureShortName { get; set; }
}
}
}
27 changes: 15 additions & 12 deletions Business/Services/Culture/CultureService.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using System.Linq;

using CMS.SiteProvider;

using Business.Dto.Culture;
using Business.Services.Context;
using CMS.SiteProvider;

namespace Business.Services.Culture
{
Expand All @@ -15,16 +17,17 @@ public CultureService(ISiteContextService siteContextService)
SiteContextService = siteContextService;
}

public IEnumerable<CultureDto> GetSiteCultures()
{
return CultureSiteInfoProvider.GetSiteCultures(SiteContextService.SiteName).Items.Select(m =>
new CultureDto()
{
CultureCode = m.CultureCode,
CultureName = m.CultureName,
CultureShortName = m.CultureShortName
}
public IEnumerable<CultureDto> GetSiteCultures() =>
CultureSiteInfoProvider.GetSiteCultures(SiteContextService.SiteName)
.Items
.Select(culture =>
new CultureDto()
{
CultureGuid = culture.CultureGUID,
CultureCode = culture.CultureCode,
CultureName = culture.CultureName,
CultureShortName = culture.CultureShortName
}
);
}
}
}
}

0 comments on commit 7ebd6f7

Please sign in to comment.