I have two model in a Asp.net core project: Person and Address:
class Person
{
public int Id {get;set;}
public string Name {get;set;}
public int? HomeAddressId {get;set;}
public Address HomeAddress {get;set;}
}
class Address
{
public int Id {get;set;}
public string CityName {get;set;}
...
}
In the person create view I need to include the fields for address attribute using a partial view for that.
How to include this partial (or write this partial) in a way that the names of elements match the correct attributes from person model?
Ex.:
<input name="HomeAddress.CityName" />
Remembering that this view should be used in another models other than person.