public ActionResult MyEvents() { var currentUser = User.Identity.Name; EventTitleViewModel eventTitle = new EventTitleViewModel(); EventOperations eventOperation = new EventOperations(); var result = eventOperation.myEvents(currentUser).Select(eventDetails => new EventTitleViewModel() { Id = eventDetails.EventId, Title = eventDetails.Title, Date = eventDetails.EventDate, }).ToList(); var passedEvents = result.Where(e => e.Date < DateTime.Now); var allupcomingEvents = result.Where(e => e.Date >= DateTime.Now); return(View("MyEvents", new UpcomingPassedEventsModel() { PassedEvents = passedEvents, FutureEvents = allupcomingEvents } )); }