Exemple #1
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 = await dbLanguage.Create(
                    language.Guid,
                    language.Name,
                    language.Code,
                    language.Sort);
            }
            else
            {
                result = await dbLanguage.Update(
                    language.Guid,
                    language.Name,
                    language.Code,
                    language.Sort);
            }

            return(result);
        }
Exemple #2
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 = await dbLanguage.Create(
                    language.Guid,
                    language.Name,
                    language.Code,
                    language.Sort);
            }
            else
            {
                result = await dbLanguage.Update(
                    language.Guid,
                    language.Name,
                    language.Code,
                    language.Sort);
            }

            return(result);
        }