Esempio n. 1
0
        public async Task <Category> Handle(GetById message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            var collection = _mongoClient.GetDatabase(_settings.Database).GetCollection <Category>(nameof(Category));

            return(await collection.Find(Builders <Category> .Filter.Eq(c => c.OriginalId, message.Id)).FirstOrDefaultAsync());
        }
Esempio n. 2
0
        public async Task <IActionResult> GetById(GetById query)
        {
            var result = await _mediator.Send(query);

            return(Ok(result));
        }