Exemplo n.º 1
0
        public Order GetOrder(int id)
        {
            var order = _db.Fetch <OrderPoco, OrderedMealPoco, StatusPoco, RestaurantPoco, OrderPoco>(
                new OrderRelator().MapIt,
                "SELECT * FROM Orders"
                + " LEFT JOIN OrderedMeals ON OrderedMeals.OrderId = Orders.Id"
                + " LEFT JOIN Statuses ON Statuses.Id = Orders.StatusId"
                + " LEFT JOIN Restaurants ON Restaurants.Id = Orders.RestaurantId"
                + " WHERE Orders.Id = @0"
                , id
                ).FirstOrDefault();

            if (order == null)
            {
                throw new KeyNotFoundException("Order has not been found.");
            }
            return(_orderMapper.MapToDomain(order));
        }
Exemplo n.º 2
0
        public Restaurant GetRestaurant(int id)
        {
            var restaurant = GetRestaurantPoco(id);

            return(_mapper.MapToDomain(restaurant));
        }