Reputation: 699
I'm new Asp.net Mvc I have one Controller and Two View.
Controller -HomeController
View -ProfileView -PageView
I must return ProfileView or PageView
My codes are working but I can not be sure this is the right approach.
This my code
if (Username == "Fatih")
{
return View("ProfileView");
}
else
{
return View("PageView");
}
Upvotes: 0
Views: 94
Reputation: 81
There is nothing wrong with your approach. The else block is not needed.just have the second return below the if block.
Upvotes: 1