public ActionResult Index(int conferenceId = currentConference) { var conference = ConferenceLayer.GetConferenceById(IbaDb,conferenceId); var eventLocationData = Db.EventLocations.Where(r => r.ConferenceId == conferenceId); var eventLocations = new List<ScheduleEventLocationItemViewModel>(); foreach(var evl in eventLocationData) { var floorName = Db.FloorNames.AsEnumerable().FirstOrDefault(r => r.Building == evl.Building && r.Floor == evl.Floor); eventLocations.Add(new ScheduleEventLocationItemViewModel() { BuildingName = evl.Building.Name, BuildingId = evl.Building.ScheduleEventBuildingId, Id = evl.ScheduleEventLocationId, RoomName = evl.LocationName, CentreX = evl.CentreX, CentreY = evl.CentreY, Lat = evl.Lat, Long = evl.Long, TranslatedTitle = evl.TranslatedTitle, Floor = evl.Floor, FloorName = floorName != null ? floorName.Name : "", IsOffsite = evl.IsOffsite }); } var viewModel = new ScheduleEventLocationViewModel { EventName = conference.Name, Locations = eventLocations }; return View(viewModel); }
//Returns the conference the user is attending next. public HttpResponseMessage Get(int id) { var access = UserRights.V2Login(Db, Request); if (access.HasErrors) { return(Request.CreateErrorResponse(access.ErrorCode, access.ErrorMessage)); } var result = ConferenceLayer.GetConferenceById(Db, id); if (result.Start.HasValue && result.End.HasValue) { var start = result.Start.Value; var end = result.End.Value; if (start < DateTime.UtcNow && end > DateTime.UtcNow) { //Conference is Live return(Request.CreateResponse(HttpStatusCode.OK, result)); } } return(Request.CreateResponse(HttpStatusCode.NoContent, result)); }