public void AddCourse(CourseNameGroup Course)
        {
            Course s = new Course
            {
                Title = Course.Title
            };

            db.Courses.Add(s);
            db.SaveChanges();
        }
예제 #2
0
 public ActionResult CreateCourse([Bind(Include = "Title")] CourseNameGroup c)
 {
     try
     {
         if (ModelState.IsValid)
         {
             Istudent.AddCourse(c);
             return(RedirectToAction("Courses"));
         }
     }
     catch (RetryLimitExceededException /* dex */)
     {
         //Log the error (uncomment dex variable name and add a line here to write a log.
         ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
     }
     return(View(c));
 }