Exemple #1
0
        public Lang AddLang(string name)
        {
            if (Langs.Any(l => l.Name.ToLower() == name.ToLower()))
            {
                return(Langs.FirstOrDefault(l => l.Name.ToLower() == name.ToLower()));
            }

            Langs.Add(new Lang {
                Id = Langs.Count != 0 ? Langs.Last().Id + 1 : 1, Name = name
            });
            return(Langs.Last());
        }
Exemple #2
0
        public string LangToString()
        {
            if (Langs == null || !Langs.Any())
            {
                return(null);
            }

            var s = new StringBuilder();

            foreach (var item in Langs)
            {
                s.Append($"{item},");
            }

            return(s.ToString().TrimEnd(new char[] { ',' }));
        }