示例#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);
        }
示例#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);
        }
示例#3
0
        public async Task <bool> Update(
            ILanguage language,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            if (language == null)
            {
                return(false);
            }
            cancellationToken.ThrowIfCancellationRequested();
            bool result = await dbLanguage.Update(
                language.Guid,
                language.Name,
                language.Code,
                language.Sort,
                cancellationToken);

            return(result);
        }