Ejemplo n.º 1
0
        public async Task AddOrUpdateExport(BeatmapExport export)
        {
            if (export.BeatmapId == null || export.BeatmapId.Length == 0)
            {
                Console.WriteLine("No beatmap found.");
                return;
            }

            var beatmap = await Beatmaps.FindAsync(export.BeatmapId);

            if (beatmap == null)
            {
                Console.WriteLine("No beatmap found.");
                return;
            }

            var exist = await Exports.FindAsync(export.Id);

            if (exist != null)
            {
                exist.UpdateTime = DateTime.Now;
                exist.ExportPath = export.ExportPath;
                exist.IsValid    = true;
            }
            else
            {
                export.Beatmap = beatmap;
                Exports.Add(export);
            }

            await SaveChangesAsync();
        }