private void UpdateCulture(FavoriteCulturePart part)
 {
     if (string.IsNullOrWhiteSpace(part.Culture))
     {
         var culture = _commonService.ListCultures().SingleOrDefault(x => x.Culture == _orchardService.WorkContext.CurrentCulture);
         part.Culture    = culture != null ? culture.Culture : "";
         part.Culture_Id = culture != null ? culture.Id: 0;
     }
 }
Ejemplo n.º 2
0
        private void LoadCulture(FavoriteCulturePart part)
        {
            var culture = _commonService.ListCultures().SingleOrDefault(x => x.Id == part.Culture_Id);

            if (culture != null)
            {
                part.Culture = culture.Culture;
            }
            else
            {
                part.Culture = _orchardService.WorkContext.CurrentCulture;
            }
        }
Ejemplo n.º 3
0
        private void LoadCulture(FavoriteCulturePart part)
        {
            var culturerecord = _cultureRepository.Table.Where(r => r.Id == part.Culture_Id).ToList().FirstOrDefault();

            if (culturerecord != null)
            {
                part.Culture = culturerecord.Culture;
            }
            else
            {
                part.Culture = _cultureRepository.Table.Where(r => r.Culture == _orchardService.WorkContext.CurrentCulture)
                               .ToList().FirstOrDefault().Culture;
            }
        }
Ejemplo n.º 4
0
        private void UpdateCulture(FavoriteCulturePart part)
        {
            bool isSiteCulture = true;

            if (part.Culture != null)
            {
                CultureRecord contentCulture = _cultureRepository.Table.Where(r => r.Culture == part.Culture)
                                               .ToList().FirstOrDefault();
                if (contentCulture != null)
                {
                    isSiteCulture   = false;
                    part.Culture    = contentCulture.Culture;
                    part.Culture_Id = contentCulture.Id;
                }
            }

            if (isSiteCulture)
            {
                CultureRecord siteCulture = _cultureRepository.Table.Where(r => r.Culture == _orchardService.WorkContext.CurrentCulture)
                                            .ToList().FirstOrDefault();
                part.Culture_Id = siteCulture.Id;
                part.Culture    = siteCulture.Culture;
            }
        }