Ejemplo n.º 1
0
 public ActionResult AddCoursePost(Cours crs)
 {
     objCourse = new Cours();
     objCourse = crs;
     objCourse.Teacher = TeacherController.GetTeacherById(int.Parse(Request.Form["TeacherId"]));
     DB.Courses.AddObject(objCourse);
     DB.SaveChanges();
     return RedirectToAction("Index", new { Controller = "Course" });
 }
 public List<Cours> GetAllCourses()
 {
     lstcourse = new List<Cours>();
     var courses = (from course in DB.Courses select course).ToList();
     foreach (Cours crs in courses)
     {
         objcourse = new Cours();
         objcourse.CourseId = crs.CourseId;
         objcourse.CourseName = crs.CourseName;
         objcourse.Location = crs.Location;
         lstcourse.Add(objcourse);
     }
     return lstcourse;
 }
 /// <summary>
 /// Create a new Cours object.
 /// </summary>
 /// <param name="courseId">Initial value of the CourseId property.</param>
 public static Cours CreateCours(global::System.Int32 courseId)
 {
     Cours cours = new Cours();
     cours.CourseId = courseId;
     return cours;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Courses EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCourses(Cours cours)
 {
     base.AddObject("Courses", cours);
 }
 public Cours GetCourseByName(string coursename)
 {
     objcourse = new Cours();
     var cours = (from courses in DB.Courses where courses.CourseName == coursename select courses).FirstOrDefault();
     objcourse = (Cours)cours;
     return objcourse;
 }