Need to create Relationship resource as well in Resource Post request.
Ajeetashukla opened this issue · 2 comments
Ajeetashukla commented
[Resource]
public class Automobile : Identifiable<int>
{
[Attr]
public int Id { get; set; }
[Attr]
public string Name { get; set; }
[Attr]
public string Type { get; set; }
}
[Resource]
public class Car : Identifiable<int>
{
[Attr]
public int Id { get; set; }
[HasOne]
public Automobile Automobile { get; set; }
[Attr]
public string Model { get; set; }
[Attr]
public string Description { get; set; }
}
I have two resources 'Automobile' and 'Car' and car has 'HasOne' relationship with Automobile. So i want to know is there any way so that i can create both car and automobile in a same 'Post' Http request?
bkoelman commented
Yes, use an atomic:operations request that creates both and links them together. See documentation and integration tests for details.
bkoelman commented
Closing due to inactivity. Please create a new issue if there are follow-up questions.