public ActionResult EventDetails(EventModel model) { if (ModelState.IsValid) { int eventId = model.AddEvent(model.EventDescription, model.StartDate, model.EndDate, model.City, model.State, User.Identity.Name); return RedirectToAction("Calendar"); } else { return View(); } }
public EventModel GetEventItem(int eventId) { EventModel model = new EventModel(); using (EventsDbEntities eventsContext = new EventsDbEntities()) { var eve = eventsContext.T_EVENTS.FirstOrDefault(ent => ent.EventId == eventId); //calItem.LoginId = eve.LoginId; // model.e = eve.EventId; model.StartDate = eve.StartDate; model.EndDate = eve.EndDate; model.EventDescription = eve.EventDescription; model.State = eve.State; model.City = eve.City; model.EventId = eventId; } return model; }
public ActionResult UpdateEvents(EventModel model) { model.UpdateEvents(model); return RedirectToAction("Calendar"); }
public ActionResult UpdateEvents(int eventId) { EventModel model = new EventModel(); model = model.GetEventItem(eventId); return View(model); }
public void UpdateEvents(EventModel model) { using (EventsDbEntities eventsContext = new EventsDbEntities()) { T_EVENTS eve = eventsContext.T_EVENTS.FirstOrDefault(e => e.EventId == model.EventId); eve.StartDate = model.StartDate; eve.EndDate = model.EndDate; eve.City = model.City; eve.State = model.State; eve.EventDescription = model.EventDescription; eventsContext.SaveChanges(); } }