public object GetSlotViewModel(string startTime) { Attendee attendee = _synchronizationService.Attendee; DateTime start; if (!DateTime.TryParse(startTime, out start)) { return(null); } Day day = attendee.Conference.Days.Ensure().FirstOrDefault(d => d.ConferenceDate == start.Date); if (day == null) { return(null); } Time time = day.Times.Ensure().FirstOrDefault(t => t.Start == start); if (time == null) { return(null); } Slot slot = attendee.NewSlot(time); return(ForView.Wrap(new SlotViewModel(slot, _imageCache))); }
public object GetSessionDetailsViewModel(string sessionId) { Attendee attendee = _synchronizationService.Attendee; Guid sessionGuid = new Guid(sessionId); Session session = attendee.Conference.Sessions.Ensure().FirstOrDefault(s => s.Unique == sessionGuid); if (session == null) { return(null); } if (session.CurrentSessionPlaces.Ensure().Count() != 1) { return(null); } SessionPlace sessionPlace = session.CurrentSessionPlaces.Single(); Slot slot = attendee.NewSlot(sessionPlace.Place.PlaceTime); return(ForView.Wrap(new SessionDetailsViewModel(slot, sessionPlace, _imageCache, _searchModel, _clock))); }