public ActionResult createProgramCohort(ProgramCohort post)
 {
     if (post.ProgramCohortID > 0)
         db.editCohort(post);
     else
         db.createProgramCohort(post);
     return RedirectToAction("Programs", new {SelectedItemID = post.ProgramID});
 }
        public ActionResult createProgramCohort(int Id, int? EditID, string mode="Create")
        {
            ViewBag.mode = mode;
            ProgramCohort model;
            if (EditID != null)
                model = db.getCohorts().Single(c => c.ProgramCohortID == EditID);
            else
                model = new ProgramCohort() { ProgramID = Id };

            return View(model);
        }
 public void editCohort(ProgramCohort cohort)
 {
     ProgramCohort cohortToEdit = db.ProgramCohorts.Find(cohort.ProgramCohortID);
     cohortToEdit.Status = cohort.Status;
     cohortToEdit.AcademicYear = cohort.AcademicYear;
     db.SaveChanges();
 }
 public void createProgramCohort(ProgramCohort cohort)
 {
     db.ProgramCohorts.Add(cohort);
     db.SaveChanges();
 }