In MVC5 controller, I do have a ActionResult which will display different reports as per users choice. I am doing it as following with no errors.


    // POST: Report Init
    public ActionResult ShowReport(ReportUserInput userInput)
        return View(userInput);

ShowReport.cshtml [View File]:

@model App.ReportUserInput

@if(Model.rep_type == EnumOldReportTypes.ByGender)
    Html.RenderAction("ByGender", Model);
else if (Model.rep_type == EnumOldReportTypes.ByAddress)
    Html.RenderAction("ByAddress", Model);

Here it works fine, I am only concerned with long if else, How can I call them without if condition something like:


Related posts

Recent Viewed