public ActionResult EditExpCode(ExpertCode expert) { if (db.ExpertCodes.Any(x => x.Code == expert.Code)) { ViewBag.same = "این شماره تکراری است."; return(View(expert)); } db.Entry(expert).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ExpertCode")); }
public ActionResult CreateExpCode(ExpertCode expert) { if (db.ExpertCodes.Any(x => x.Code == expert.Code)) { ViewBag.same = "این شماره تکراری است."; return(View(expert)); } db.ExpertCodes.Add(expert); db.SaveChanges(); return(RedirectToAction("ExpertCode")); }