public ActionResult CourseSearchByMajorOrCourseNo(CourseSearchViewModels obj) { string maja = Enum.GetName(typeof(Major), obj.Major); string cn = obj.Number; if (cn == null && maja != null) { return(PartialView("_CourseSearchPartial", c.GetCourseByMajor(maja))); } else { return(PartialView("_CourseSearchPartial", c.GetCourseByNumber(cn))); } }