Below is DD4T code that I need to rewrite to DXA. Find the Schema name of the Linked Component and perform an action based on the schema.
IComponent component = Model.Fields["linkedComponent"].LinkedComponentValues[0];
if (component.Schema.Title == "SomeSchema")
{
if (component.Fields.ContainsKey("field1"))
{
string form = component.Fields["field1"].Value;
}
if (component.Fields.ContainsKey("field2"))
{
string formID = component.Fields["field2"].LinkedComponentValues[0].Fields["SecondLevelField"].Value;
}
}
else if(component.Schema.Title == "SomeOtherSchema")
{
if (component.Fields.ContainsKey("someOtherField"))
{
string someOtherField = component.Fields["someOtherField"].Value;
}
}
Is this possible in DXA2.0