Exemplo n.º 1
0
        public async Task <Part> UpdateAndGetByNumberAndColor(string number, Color color)
        {
            var part = await GetByNumberAndColor(number, color);

            if (part == null)
            {
                part = await brickLinkDataConnector.GetPart(number, color);

                await Save(part);
            }

            return(part);
        }
        private async Task <Part> UpdateAndGetPartByNumberAndColor(string number, Color color)
        {
            var part = await Context.Parts
                       .Find(p => p.Number.Equals(number) && p.Color.Equals(color))
                       .SingleOrDefaultAsync();

            if (part == null)
            {
                part = await brickLinkDataConnector.GetPart(number, color);

                await Context.Parts.InsertOneAsync(part);
            }

            return(part);
        }