public ActionResult DeleteConfirmed(int id)
        {
            PhasesOfSchoole phasesOfSchoole = db.PhasesOfSchooles.Find(id);

            phasesOfSchoole.Is_Deleted = true;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: PhasesOfSchooles/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("errorpage", "home"));
            }
            PhasesOfSchoole phasesOfSchoole = db.PhasesOfSchooles.Find(id);

            if (phasesOfSchoole == null)
            {
                return(RedirectToAction("errorpage", "home"));
            }
            return(View(phasesOfSchoole));
        }
        public ActionResult Create(PhasesOfSchoole phasesOfSchoole)
        {
            if (ModelState.IsValid)
            {
                var data = db.PhasesOfSchooles.Where(a => a.Is_Deleted != true && a.PhaseName == phasesOfSchoole.PhaseName).SingleOrDefault();
                if (data != null)
                {
                    ViewBag.errPhase = Languages.Language.errPhase;
                    return(View(phasesOfSchoole));
                }
                db.PhasesOfSchooles.Add(phasesOfSchoole);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(phasesOfSchoole));
        }
        public ActionResult Edit(PhasesOfSchoole phasesOfSchoole)
        {
            if (ModelState.IsValid)
            {
                var data = db.PhasesOfSchooles.Where(a => a.Id != phasesOfSchoole.Id && a.Is_Deleted != true);
                foreach (var item in data)
                {
                    if (item.PhaseName == phasesOfSchoole.PhaseName)
                    {
                        ViewBag.errPhase = Languages.Language.errPhase;
                        return(View(phasesOfSchoole));
                    }
                }

                var old = db.PhasesOfSchooles.Find(phasesOfSchoole.Id);
                old.PhaseName       = phasesOfSchoole.PhaseName;
                old.PhaseNameArabic = phasesOfSchoole.PhaseNameArabic;
                old.Year            = phasesOfSchoole.Year;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(phasesOfSchoole));
        }