示例#1
0
        public ActionResult EditExpert(Experty experty)
        {
            if (db.Experts.Any(x => x.Name == experty.Name))
            {
                ViewBag.same = "این تخصص قبلا ثبت شده است.";
                return(View(experty));
            }

            db.Entry(experty).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Experts"));
        }
示例#2
0
        public ActionResult CreateExpert(Experty experty)
        {
            if (db.Experts.Any(x => x.Name == experty.Name))
            {
                ViewBag.same = "این تخصص قبلا ثبت شده است.";
                return(View(experty));
            }

            db.Experts.Add(experty);
            db.SaveChanges();
            return(RedirectToAction("Experts"));
        }