public ActionResult Create([Bind(Include = "batch_code,name,batch_starting_date,admission_last_date,room_number,faculty_name,amount,details,routine")] Batche batche)
        {
            if (ModelState.IsValid)
            {
                if (batche.admission_last_date >= batche.batch_starting_date)
                {
                    ModelState.AddModelError("admission_last_date", "Admission Last Date Cant Be Same As Batch Starting Date Or Greater Than Batch Starting Date!");
                    ViewBag.Day7           = MyCustomFunctions.Day7();
                    ViewBag.vendor_heading = new SelectList(db.Courses, "vendor_heading", "vendor_heading");
                    ViewBag.faculty_name   = new SelectList(db.Instructors, "faculty_name", "faculty_name");
                    ViewBag.name           = new SelectList(db.Courses, "name", "vendor_heading", batche.name);
                    return(View(batche));
                }
                db.Batches.Add(batche);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Day7           = MyCustomFunctions.Day7();
            ViewBag.vendor_heading = new SelectList(db.Courses, "vendor_heading", "vendor_heading");
            ViewBag.faculty_name   = new SelectList(db.Instructors, "faculty_name", "faculty_name");
            ViewBag.name           = new SelectList(db.Courses, "name", "vendor_heading", batche.name);

            return(View(batche));
        }
 public ActionResult Create()
 {
     ViewBag.Day7           = MyCustomFunctions.Day7();
     ViewBag.vendor_heading = new SelectList(db.Courses, "vendor_heading", "vendor_heading");
     ViewBag.faculty_name   = new SelectList(db.Instructors, "faculty_name", "faculty_name");
     ViewBag.name           = new SelectList(db.Courses, "name", "name");
     return(View());
 }
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Batche batche = db.Batches.Find(id);

            if (batche == null)
            {
                return(HttpNotFound());
            }

            ViewBag.Day7 = MyCustomFunctions.Day7();
            ViewBag.vendor_headingList = new SelectList(db.Courses, "vendor_heading", "vendor_heading");
            ViewBag.faculty_nameList   = new SelectList(db.Instructors, "faculty_name", "faculty_name");
            ViewBag.nameList           = new SelectList(db.Courses, "name", "name", batche.name);
            return(View(batche));
        }