public static async Task <HttpResponseMessage> Run(HttpRequestMessage req)
        {
            if (req.Method == HttpMethod.Get)
            {
                string id = req.GetQueryNameValuePairs()
                            .FirstOrDefault(q => q.Key == "id")
                            .Value;

                if (!string.IsNullOrEmpty(id))
                {
                    MongoConfig.RegisterMappings();
                    var mongoClient         = new MongoClient(ConfigurationManager.AppSettings["MongoDbConnectionString"]);
                    var customersCollection =
                        mongoClient.GetDatabase(ConfigurationManager.AppSettings["MongoDbDatabase"])
                        .GetCollection <RoboBank.Customer.Domain.Customer>("customers");

                    var customerApplicationService =
                        new CustomerApplicationService(new MongoCustomerRepository(customersCollection),
                                                       new Application.Adapters.Mapper());

                    var customerInfo = await customerApplicationService.GetByIdAsync(id);

                    if (customerInfo != null)
                    {
                        return(req.CreateResponse(HttpStatusCode.OK, AutoMapper.Mapper.Map <CustomerInfo, CustomerModel>(customerInfo)));
                    }
                }

                return(req.CreateResponse(HttpStatusCode.NotFound));
            }

            return(req.CreateErrorResponse(HttpStatusCode.BadRequest, "Method not supported"));
        }
        public async Task <IHttpActionResult> GetByIdAsync(string id)
        {
            var customerInfo = await _customerApplicationService.GetByIdAsync(id);

            if (customerInfo != null)
            {
                return(Ok(Mapper.Map <CustomerInfo, CustomerModel>(customerInfo)));
            }

            return(NotFound());
        }