Ejemplo n.º 1
0
        public async Task <bool> Save(ILanguage language)
        {
            if (language == null)
            {
                return(false);
            }
            bool result;

            if (language.Guid == Guid.Empty)
            {
                language.Guid = Guid.NewGuid();

                result = dbLanguage.Create(
                    language.Guid,
                    language.Name,
                    language.Code,
                    language.Sort);
            }
            else
            {
                result = dbLanguage.Update(
                    language.Guid,
                    language.Name,
                    language.Code,
                    language.Sort);
            }
            return(result);
        }
Ejemplo n.º 2
0
        public async Task <bool> Save(ILanguage language, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (language == null)
            {
                return(false);
            }
            cancellationToken.ThrowIfCancellationRequested();
            bool result;

            if (language.Guid == Guid.Empty)
            {
                language.Guid = Guid.NewGuid();

                result = dbLanguage.Create(
                    language.Guid,
                    language.Name,
                    language.Code,
                    language.Sort);
            }
            else
            {
                result = dbLanguage.Update(
                    language.Guid,
                    language.Name,
                    language.Code,
                    language.Sort);
            }
            return(result);
        }