Пример #1
0
 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();
     }
 }
Пример #2
0
        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;
        }
Пример #3
0
 public ActionResult UpdateEvents(EventModel model)
 {
     model.UpdateEvents(model);
     return RedirectToAction("Calendar");
 }
Пример #4
0
 public ActionResult UpdateEvents(int eventId)
 {
     EventModel model = new EventModel();
     model = model.GetEventItem(eventId);
     return View(model);
 }
Пример #5
0
        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();
            }
        }