// POST: /Home/CreateEmployee // [HttpPost, ActionName("Request rc")] public ActionResult RequestCycleAdminInsertion() { if (ModelState.IsValid) { // { // db.RequestCycles.Add(rc); // db.SaveChanges(); // return RedirectToAction("DisplayImage", "Image"); //} ViewBag.dropdownlist = new SelectList((from r in db.CycleDetails where !(from u in db.RequestCycles select u.CycleID).Contains(r.CycleID) select r).Distinct() , "CycleID", "CycleID"); var cycleIDList = new SelectList((from r in db.CycleDetails where !(from u in db.RequestCycles select u.CycleID).Contains(r.CycleID) select r).Distinct() , "", "CycleID"); //ViewBag.currentDate = @DateTime.Now.Date; - testing if (cycleIDList.ElementAtOrDefault(0) == null) { ViewBag.CycleIDError = "Sorry. Currently there are no Cycles available to raise a request."; } else { return(View()); } } return(View()); }