Esempio n. 1
0
        public ActionResult Create(School school)
        {
            if (ModelState.IsValid)
            {
                db.Schools.AddObject(school);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", school.CountryId);
            ViewBag.InstructorId = new SelectList(db.Students, "StudentId", "WKSAId", school.InstructorId);
            return View(school);
        }
Esempio n. 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Schools EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSchools(School school)
 {
     base.AddObject("Schools", school);
 }
Esempio n. 3
0
 public ActionResult Edit(School school)
 {
     if (ModelState.IsValid)
     {
         db.Schools.Attach(school);
         db.ObjectStateManager.ChangeObjectState(school, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", school.CountryId);
     ViewBag.InstructorId = new SelectList(db.Students, "StudentId", "WKSAId", school.InstructorId);
     return View(school);
 }
Esempio n. 4
0
 /// <summary>
 /// Create a new School object.
 /// </summary>
 /// <param name="schoolId">Initial value of the SchoolId property.</param>
 /// <param name="schoolCode">Initial value of the SchoolCode property.</param>
 /// <param name="schoolName">Initial value of the SchoolName property.</param>
 /// <param name="countryId">Initial value of the CountryId property.</param>
 /// <param name="instructorName">Initial value of the InstructorName property.</param>
 public static School CreateSchool(global::System.Int32 schoolId, global::System.String schoolCode, global::System.String schoolName, global::System.Int32 countryId, global::System.String instructorName)
 {
     School school = new School();
     school.SchoolId = schoolId;
     school.SchoolCode = schoolCode;
     school.SchoolName = schoolName;
     school.CountryId = countryId;
     school.InstructorName = instructorName;
     return school;
 }