Created
July 7, 2020 18:25
-
-
Save gavilanch/997c6cf97e841787125983ec99fa2073 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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; | |
} |
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
Hi Felipe,
i'm still stuck. (my entity frameworks knowledge is lacking).. this is my individualperson.razor. -- i can render the name,dob, picture, and bio ok. It says no records to show, but there should be one.
Is this close at all?
@Person.Name
@Person.DateOfBirth.Value.ToString("MMMM dd yyyy")

@foreach (var item in MoviesActors) { }}
@code {
[Parameter] public int PersonId { get; set; }
Person Person;
}