Пример #1
0
 /// <summary>
 /// Check which exhibits are unlocked and mark them as visited
 /// in the API.
 /// </summary>
 /// <returns></returns>
 internal async Task PostVisitedExhibitsToApi()
 {
     var exhibits          = dataAccess.Exhibits().GetExhibits();
     var visitedExhibitIds = exhibits.Where(e => e.Unlocked).Select(e => e.IdForRestApi).ToList();
     var action            = new ExhibitsVisitedActionDto(visitedExhibitIds);
     await IoCManager.Resolve <IAchievementsApiAccess>().PostExhibitVisited(action);
 }
Пример #2
0
 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());
 }
Пример #3
0
        public async Task <bool> AnyExhibitChanged(IReadOnlyDataAccess dataAccess)
        {
            ExhibitsDto changedExhibits;

            var dbExhibits = dataAccess.Exhibits().GetExhibits().ToList();

            if (dbExhibits.Any())
            {
                var latestTimestamp = dbExhibits.Max(x => x.Timestamp);
                changedExhibits = await exhibitsApiAccess.GetExhibits(latestTimestamp);
            }
            else
            {
                changedExhibits = await exhibitsApiAccess.GetExhibits();
            }

            fetchedChangedExhibits = changedExhibits.Items;
            return(fetchedChangedExhibits.Any());
        }