public ActionResult Edit(CommSuperAdmin commsuperadmin) { if (ModelState.IsValid) { db.Entry(commsuperadmin).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Divisions", new { primaryKey1 = commsuperadmin.CommOwn_ID })); } return(View(commsuperadmin)); }
public ActionResult Edit(string primaryKey1 = "", int primaryKey2 = 0, string primaryKey3 = "") { //convert primaryKey3 into a valid dateTime object, if not valid return page not found. DateTime meetingPKDateTime; if (!DateTime.TryParse(primaryKey3, out meetingPKDateTime)) { return(HttpNotFound()); } CommSuperAdmin commsuperadmin = db.CommSuperAdmin.Find(primaryKey1, primaryKey2, meetingPKDateTime); if (commsuperadmin == null) { return(HttpNotFound()); } return(View(commsuperadmin)); }
public ActionResult Create(int primaryKey1, CommSuperAdmin commsuperadmin) { commsuperadmin.CommOwn_ID = primaryKey1; commsuperadmin.CreatedBy = User.Identity.Name; commsuperadmin.CreatedDate = DateTime.Now; if (db.CommSuperAdmin.Any(CSA => CSA.CommOwn_ID == primaryKey1 && CSA.SysUser_Email == commsuperadmin.SysUser_Email && CSA.StartDate == commsuperadmin.StartDate)) { ModelState.AddModelError("StartDate", "User already has this start date for this Division"); } else if (ModelState.IsValid) { db.CommSuperAdmin.Add(commsuperadmin); db.SaveChanges(); return(RedirectToAction("Index", "Divisions", new { primaryKey1 = primaryKey1 })); } ViewBag.CommOwn_ID = primaryKey1; ViewBag.SysUser_Email = new SelectList(db.SysUser, "Email", "Email"); return(View(commsuperadmin)); }