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")); }
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")); }