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)); }
public Restaurant GetRestaurant(int id) { var restaurant = GetRestaurantPoco(id); return(_mapper.MapToDomain(restaurant)); }