public async Task GetProduct()

in TailwindTraders.Website/Source/Tailwind.Traders.Web/Standalone/Services/ProductService.cs [38:76]


        public async Task<Product> GetProduct(int id)
        {
            await OpenConnection();
            var results = await sqlConnection.QueryAsync<Product, ProductBrand, ProductType, Product>(@"
                SELECT p.Id
                    ,p.Name
                    ,Price
                    ,ImageName as ImageUrl
                    ,BrandId
                    ,TypeId
                    ,TagId
                    ,b.Id
                    ,b.Name
                    ,t.Id
                    ,t.Code
                    ,t.Name
                FROM Products as p
                INNER JOIN Brands as b ON p.BrandId = b.Id
                INNER JOIN Types as t ON p.TypeId = t.Id
                WHERE p.Id = @Id
            ", (p, b, t) =>
            {
                p.Brand = b;
                p.Type = t;
                p.ImageUrl = $"{productImagesUrl}/{p.ImageUrl}";
                return p;
            }, new { Id = id });

            var product = results.FirstOrDefault();

            if (product != null)
            {
                product.Features = await sqlConnection.QueryAsync<ProductFeature>(@"
                    SELECT * FROM Features WHERE ProductItemId = @Id
                ", new { Id = id });
            }

            return product;
        }