public IHttpActionResult GetSceneById(int id = 0) { var responseList = new List <PanoramaSceneModel>(); var location = _locationService.GetLocationById(id); if (location == null) { return(NotFound()); } var defaultScene = _sceneService.GetPnoramaSceneById(location.DefaultPanoramaSceneId); if (defaultScene != null) { defaultScene.Views++; _sceneService.UpdatePanoramaScene(defaultScene); var response1 = defaultScene.ToModel(); response1.Name = defaultScene.PanoramaLocation.Name + response1.ProductionDate; response1.Title = defaultScene.PanoramaLocation.Name; response1.hotspots = defaultScene.Hotspots.Select(h => { var hmodel = h.ToModel(); return(hmodel); }).ToList(); responseList.Add(response1); if (location.PanoramaScenes.Count() > 1) { var scene2 = location.PanoramaScenes.Last(); var response2 = scene2.ToModel(); response2.Name = scene2.PanoramaLocation.Name + response2.ProductionDate; response2.Title = scene2.PanoramaLocation.Name; response2.hotspots = scene2.Hotspots.Select(h => { var hmodel = h.ToModel(); return(hmodel); }).ToList(); responseList.Add(response2); } } return(Ok(responseList)); }