public IActionResult GetById(long id) { var product = _mongoRepository.GetCustomer(id); if (product == null) { return(NotFound()); } return(new ObjectResult(product)); }
private void ListenUpdated(Subscription subscriptionUpdated) { BasicDeliverEventArgs eventArgsUpdated = subscriptionUpdated.Next(); if (eventArgsUpdated != null) { string messageContent = Encoding.UTF8.GetString(eventArgsUpdated.Body); CustomerUpdatedEvent _updated = JsonConvert.DeserializeObject <CustomerUpdatedEvent>(messageContent); _repository.Update(_updated.ToCustomerEntity((CustomerEntity)_repository.GetCustomer(_updated.Id))); subscriptionUpdated.Ack(eventArgsUpdated); } }