Example #1
0
        private async Task <SyncDetails> UpdateSyncDetailsAsync(SyncDetails syncDetails, int studioId, int pageIndex)
        {
            if (syncDetails == null)
            {
                syncDetails = new SyncDetails
                {
                    Studio = new Domain.Entities.Studio
                    {
                        StudioId = studioId
                    }
                };
            }

            syncDetails.LastSyncDate = DateTime.UtcNow;
            syncDetails.LastSyncPage = pageIndex;

            if (syncDetails.SyncDetailsId == 0)
            {
                var saved = await _syncDetailsRepository.AddAsync(syncDetails);

                syncDetails.SyncDetailsId = saved.SyncDetailsId;
            }
            else
            {
                await _syncDetailsRepository.UpdateAsync(syncDetails);
            }

            return(syncDetails);
        }
Example #2
0
        private async Task <SyncDetails> GetSyncDetailsAsync(IStudioClient studioClient)
        {
            var studio = await GetStudioAsync(studioClient);

            var syncDetails = await _syncDetailsRepository.FindByStudioAsync(studio.StudioId);

            if (syncDetails == null)
            {
                syncDetails = await _syncDetailsRepository.AddAsync(new SyncDetails
                {
                    Studio = studio
                });
            }

            return(syncDetails);
        }