public ActionResult Edit([Bind(Include = "EventTypeId,Type")] EventType eventType) { if (ModelState.IsValid) { db.Entry(eventType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(eventType)); }
public ActionResult Edit([Bind(Include = "EventId,EventTypeId,Title,Description,StartDate,EndDate,City,State,OrganizationName,OrganizationContactInfo,MaxTickets,AvailableTickets")] Event @event) { if (@event.StartDate < DateTime.Now) { ModelState.AddModelError("StartDate", "Start Date can not be in the past."); } if (ModelState.IsValid) { db.Entry(@event).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EventTypeId = new SelectList(db.EventTypes, "EventTypeId", "Type", @event.EventTypeId); return(View(@event)); }