Skip to content

Instantly share code, notes, and snippets.

@gavilanch
Created July 7, 2020 18:25
Show Gist options
  • Save gavilanch/997c6cf97e841787125983ec99fa2073 to your computer and use it in GitHub Desktop.
Save gavilanch/997c6cf97e841787125983ec99fa2073 to your computer and use it in GitHub Desktop.
[HttpGet("{id}")]
public async Task<ActionResult<Person>> Get(int id)
{
var person = await context.People.Include(x => x.MoviesActors).ThenInclude(x => x.Movie).FirstOrDefaultAsync(x => x.Id == id);
if (person == null) { return NotFound(); }
return person;
}
@CMcLean48
Copy link

oops..sorry markup didn't work too well. I got it working using a generic list, and foreach (var item in Person.MoviesActors). Now to try to render using movielist component.. it looks so much better :-). Thanks for the controller code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment