public ActionResult EditGroup([Bind(Include = "pgrID,pgrName,pgrOfcFirstName,pgrOfcLastName,pgrPhone,pgrStreet1,pgrStreet2,pgrCity,pgrState,pgrZip")] Pagroup group) { if (ModelState.IsValid) { db.Entry(group).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("IndexGroup")); } return(View(group)); }
public ActionResult EditGroup(int?id) { ViewBag.FullName = getUserName(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Pagroup group = db.Pagroups.Find(id); if (group == null) { return(HttpNotFound()); } return(View(group)); }
public ActionResult CreateGroup([Bind(Include = "pgrID, pgrName, pgrOfcFirstName, pgrOfcLastName, pgrPhone, pgrStreet1, pgrStreet2, pgrCity, pgrState, pgrZip")] Pagroup group) { try { //var alreadyExists = db.Employers.Any(v => v.empName == employer.empName); if (ModelState.IsValid) { db.Pagroups.Add(group); db.SaveChanges(); return(RedirectToAction("IndexGroup", "ManageContracts")); } } catch (DataException) { ModelState.AddModelError("", "Unable to save changes.Try again, and if the problem persists see your system administrator."); } return(View(group)); }