// THis is From Servicess DI, AddTransient inject Object here public async Task <IActionResult> CallActionBC([FromServices] IB B, IC C) { // Get Methods and Properties of Class without creating their objects ViewBag.DataB = await B.GetDataB(); ViewBag.DataC = await C.GetDataC(); return(View()); }
// This is normal calling in DI with Constructor public async Task <IActionResult> Index() { // Get Methods and Properties of Class without creating their objects ViewBag.DataA = await A.GetDataA(); ViewBag.DataB = await B.GetDataB(); ViewBag.DataC = await C.GetDataC(); return(View()); }