I've been trying to search in both Google and here if there was a question similar to mine but most of the questions involved the opposite of what I want to happen.
So I have an object like this:
class MyObject
{
int SomeID {get; set;}
string SomeName {get; set;}
List<AnotherObjectContainingIDAndString> {get; set;}
}
So after creating my controller and filling up my object, I tried sending it over and when I checked through Postman I get all the properties except for the List one. My question is if this is even possible or if I'm not able to send an array within an object?
Here's how my controller looks like for a bit of context:
[HttpGet("{id}"]
public async Task<ActionResult<MyObj>> GetById(int id)
{
var myObj = await _context.MyObjs.Where(t => t.Id == id).SingleOrDefaultAsync();
if (myObj == null)
{
return NotFound();
}
List<ObjectDescribedInPreviousCodeBlock> myList = new List<ObjectDescribedInPreviousCodeBlock>();
//Fill the list up
var toSendOver = new MyObject();
//Assign the properties to toSendOver
return toSendOver;
}