public ActionResult DeleteConfirmed(int id)
        {
            RIGISTRATION_COURSE rIGISTRATION_COURSE = db.RIGISTRATION_COURSE.Find(id);

            db.RIGISTRATION_COURSE.Remove(rIGISTRATION_COURSE);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "IDRegist,NameParent,Phone,Email,NameStudent,BIRTHDAY,ADDRESS,IDCourse,State")] RIGISTRATION_COURSE rIGISTRATION_COURSE)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rIGISTRATION_COURSE).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IDCourse = new SelectList(db.COURSEs, "IDCourse", "Name", rIGISTRATION_COURSE.IDCourse);
     return(View(rIGISTRATION_COURSE));
 }
        // GET: ADMIN/Rigistration_course/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RIGISTRATION_COURSE rIGISTRATION_COURSE = db.RIGISTRATION_COURSE.Find(id);

            if (rIGISTRATION_COURSE == null)
            {
                return(HttpNotFound());
            }
            return(View(rIGISTRATION_COURSE));
        }
        // GET: ADMIN/Rigistration_course/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RIGISTRATION_COURSE rIGISTRATION_COURSE = db.RIGISTRATION_COURSE.Find(id);

            if (rIGISTRATION_COURSE == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IDCourse = new SelectList(db.COURSEs, "IDCourse", "Name", rIGISTRATION_COURSE.IDCourse);
            return(View(rIGISTRATION_COURSE));
        }
예제 #5
0
        public ActionResult Register(FormCollection collection)
        {
            if (string.IsNullOrEmpty(collection["ADDRESS"]) || string.IsNullOrEmpty(collection["BIRTHDAY"]) ||
                string.IsNullOrEmpty(collection["Email"]) || string.IsNullOrEmpty(collection["IDCourse"]) ||
                string.IsNullOrEmpty(collection["NameParent"]) || string.IsNullOrEmpty(collection["NameStudent"]) ||
                string.IsNullOrEmpty(collection["Phone"]))
            {
                ViewBag.ErrorMsg = "Đăng kí thất bại, vui lòng thử lại sau";
                ViewBag.IDCourse = collection["IDCourse"];
                ViewBag.Name     = collection["Name"];
                return(View("Register"));
            }
            RIGISTRATION_COURSE rc = new RIGISTRATION_COURSE();
            var model = new KhoaHocModel();

            rc.ADDRESS     = collection["ADDRESS"];
            rc.BIRTHDAY    = DateTime.Parse(collection["BIRTHDAY"]);
            rc.Email       = collection["Email"];
            rc.IDCourse    = collection["IDCourse"];
            rc.NameParent  = collection["NameParent"];
            rc.NameStudent = collection["NameStudent"];
            rc.Phone       = collection["Phone"];

            //const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            Random random = new Random();

            //rc.IDRegist = new string(Enumerable.Repeat(chars, 6).Select(s => s[random.Next(s.Length)]).ToArray());
            //rc.DayRegist = DateTime.Today;
            rc.State = "Chưa Duyệt";
            bool rs = model.Insert(rc);

            if (rs)
            {
                return(RedirectToAction("Index", "KhoaHoc"));
            }
            else
            {
                ViewBag.IDCourse = collection["IDCourse"];
                ViewBag.Name     = collection["Name"];
                ViewBag.ErrorMsg = "Đăng kí thất bại, vui lòng thử lại sau";
                return(View("Register"));
            }
        }