I want to push a ProductPhoto inside the Product using LINQ. Here is my model:
public class Product
{
public string Id { get; set; }
public string Name { get; set; }
public string Detail { get; set; }
public List<ProductPhoto> ProductPhotos { get; set; }
}
public class ProductPhoto
{
public string Id { get; set; }
public string Url { get; set; }
}
How can I achieve this with the LINQ query? I am expecting the result to be something like this.
{
_id: ObjectId('602d2149e773f2a3990b47f5'),
Name: 'Some name',
Detail: 'Some description',
ProductPhotos: [
{ _id: ObjectId('602d2149e773f2a3990b47f5'), Url: 'Some URL' }
]
}
Next time when I add a new ProductPhoto, then there will be two elements.
Thanks!