Esempio n. 1
0
        public static async Task <bool> Exists(this ITextItemTypeRepository repository, Guid identity)
        {
            var textItemTypeIdentity = TextItemTypeIdentity.From(identity);

            var exists = await repository.Exists(textItemTypeIdentity);

            return(exists);
        }
        public async Task <TextItemTypeIdentity> GetItemType(TextItemIdentity identity)
        {
            var textItemTypeIdentity = await this.ExecuteInContextAsync(async dbContext =>
            {
                var textItemTypeGuid = await dbContext.TextItems.Where(x => x.GUID == identity.Value).Select(x => x.TextItemType.GUID).SingleAsync();

                var output = TextItemTypeIdentity.From(textItemTypeGuid);
                return(output);
            });

            return(textItemTypeIdentity);
        }
Esempio n. 3
0
        public async Task <TextItemTypeIdentity> GetIdentity(string name)
        {
            var identity = await this.ExecuteInContextAsync(async dbContext =>
            {
                var guid = await dbContext.TextItemTypes.Where(x => x.Name == name).Select(x => x.GUID).SingleAsync();

                var output = TextItemTypeIdentity.From(guid);
                return(output);
            });

            return(identity);
        }
Esempio n. 4
0
        public async Task <TextItemType> Get(TextItemTypeIdentity identity)
        {
            var textItemType = await this.ExecuteInContextAsync(async dbContext =>
            {
                var entity = await dbContext.TextItemTypes.Where(x => x.GUID == identity.Value).SingleAsync();

                var output = new TextItemType()
                {
                    Identity = TextItemTypeIdentity.From(entity.GUID),
                    Name     = entity.Name,
                };
                return(output);
            });

            return(textItemType);
        }
Esempio n. 5
0
        public async Task <TextItemType> Get(string name)
        {
            var textItemType = await this.ExecuteInContextAsync(async dbContext =>
            {
                var entity = await dbContext.TextItemTypes.Where(x => x.Name == name).SingleAsync();

                var output = new TextItemType()
                {
                    Identity = TextItemTypeIdentity.From(entity.GUID),
                    Name     = entity.Name, // Use entity name, not the input name for exactness.
                };
                return(output);
            });

            return(textItemType);
        }