public ActionResult RemoveDepartmentPrefix(DepartmentPrefixItem entity)
        {
            int deptId = entity.DepartmentId;

            ScheduleManager manager = new ScheduleManager();

            if (manager.RemoveDepartmentPrefixEntry(entity.PrefixId))
            {
                return RedirectToAction("EditDepartment", new { id = deptId });
            }
            else
            {
                return View("RemoveDepartmentPrefix", entity);
            }
        }
        public JsonResult AddPrefixToDepartment(DepartmentPrefixItem entity)
        {
            ScheduleManager manager = new ScheduleManager();

            if (manager.AddPrefixToDepartment(entity))
            {
                return Json(new { success = true });
            }
            else
            {
                return Json(new { success = false });
            }
        }
        public bool AddPrefixToDepartment(DepartmentPrefixItem entity)
        {
            bool result = false;

            using (ScheduleDataContext ctx = new ScheduleDataContext())
            {

                DepartmentPrefix misc = new DepartmentPrefix();

                misc.DepartmentID = entity.DepartmentId;
                misc.Prefix = entity.PrefixText;

                ctx.DepartmentPrefixes.InsertOnSubmit(misc);

                try
                {
                    ctx.SubmitChanges();
                    result = true;

                }
                catch (Exception ex)
                {
                    throw new Exception("Unable to add prefix: " + ex.Message);
                }

            }

            return result;
        }
        public ActionResult AddPrefixToDepartment(int id)
        {
            ScheduleManager manager = new ScheduleManager();

            ViewBag.PrefixList = manager.GetDepartmentPrefixesFromHP();
            var model = new DepartmentPrefixItem();
            model.DepartmentId = id;

            return PartialView("_AddPrefixToDepartment", model);
        }
        public DepartmentPrefixItem GetDepartmentPrefixItem(int id)
        {
            using (ScheduleDataContext ctx = new ScheduleDataContext())
            {

                var item = ctx.DepartmentPrefixes.Where(d => d.DepartmentPrefixID == id).SingleOrDefault<DepartmentPrefix>();

                DepartmentPrefixItem result = new DepartmentPrefixItem();

                try
                {
                    result.DepartmentId = item.DepartmentID;
                    result.PrefixId = item.DepartmentPrefixID;
                    result.PrefixText = item.Prefix;
                }
                catch (Exception ex)
                {
                    throw new Exception("Unable to get Prefix: " + ex.Message);
                }

                return result;
            }
        }