public ActionResult Index(string courses) { try { string[] courseList = courses.Trim().Split(new string[] { ",", "\n" }, StringSplitOptions.RemoveEmptyEntries); _college.AddCourses(courseList); } catch (Exception ex) { ViewBag.ErrorMessage = ex.Message; } return(View(_college)); }
// POST: api/CollegeCourse public string Post([FromBody] string courses) { try { string[] courseList = courses.Trim().Split(new string[] { ",", "\n" }, StringSplitOptions.RemoveEmptyEntries); _college.AddCourses(courseList); return(_college.Schedule); } catch (Exception ex) { return(ex.Message); } }