public override void Convert(QuizDto dto, Quiz existingModelObject) { existingModelObject.Status = dto.Status; existingModelObject.Timestamp = dto.Timestamp; existingModelObject.Id = dto.Id.ToString(); existingModelObject.Text = dto.Text; existingModelObject.Exhibit = dataAccess.Exhibits().GetExhibits().First(it => it.IdForRestApi == dto.ExhibitId); existingModelObject.Options = dto.Options; existingModelObject.Image = dataAccess.GetItem <Image>(dto.Image?.ToString()); }
/// <summary> /// Get an exhibit with a specific id including its image and the IDs of its pages. /// </summary> /// <param name="id">The id of the exhibit to be retrived.</param> /// <returns>The exhibit with the given id. If no exhibit exists, null is returned.</returns> public Exhibit GetExhibit(string id) { if (!string.IsNullOrEmpty(id)) { return(dataAccess.GetItem <Exhibit>(id, nameof(Exhibit.Image), nameof(Exhibit.PagesRefs) + '.' + nameof(JoinExhibitPage.Page) + '.' + nameof(Page.Audio))); } return(null); }
/// <summary> /// Returns the Route with the specific ID including its waypoints, tags, image and audio. /// </summary> /// <param name="id">The id of the specific Route to be passed</param> /// <returns>The Route with given id. If Route does not exits, return null</returns> public Route GetRoute(string id) { if (!string.IsNullOrEmpty(id)) { return(dataAccess.GetItem <Route>(id, nameof(Route.TagsRefs) + '.' + nameof(JoinRouteTag.Tag) + '.' + nameof(RouteTag.Image), nameof(Route.Image), nameof(Route.Audio), nameof(Route.Waypoints) + '.' + nameof(Waypoint.Exhibit))); } return(null); }