Пример #1
0
        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));
        }
Пример #2
0
        // 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);
            }
        }