public EventViewModel(Event e) { this.EndDate = e.EndDate; this.EventId = e.EventId; this.EventName = e.EventName; this.QuestionList = e.QuestionList; this.StartDate = e.StartDate; }
public ActionResult AddEvent(Event model) { if (ModelState.IsValid) { using (var context = new LeadGenContext()) { context.Events.Add(model); context.SaveChanges(); } return RedirectToAction("EventDetails", "Admin", new { id = model.EventId }); } return View(model); }