Exemple #1
0
        // GET: Admin/RegistrationMinors/Delete/5
        public ActionResult Delete(int?id)
        {
            RegistrationMinor registrationMinor = db.RegistrationMinors.Find(id);

            db.RegistrationMinors.Remove(registrationMinor);
            db.SaveChanges();
            return(RedirectToAction("Create", "RegistrationMinors", new { area = "Admin", id = id, tab = 2 }));
        }
Exemple #2
0
        public ActionResult Create([Bind(Include = "Id,TrainingCourseId,Sort,Name,Length,IsRequired")] RegistrationMinor registrationMinor, int?id)
        {
            if (ModelState.IsValid)
            {
                if (id != null)
                {
                    registrationMinor.TrainingCourseId = (int)id;
                    db.RegistrationMinors.Add(registrationMinor);
                    db.SaveChanges();
                    TempData["RcMessage"] = "已加入欄位";
                    return(RedirectToAction("Create", "RegistrationMinors", new { area = "Admin", id = id, tab = 1 }));
                }
            }

            ViewBag.TrainingCourseId = new SelectList(db.TrainingCourses, "Id", "Title", registrationMinor.TrainingCourseId);
            return(View(registrationMinor));
        }