Ejemplo n.º 1
0
        public async Task MapPerson(int showId)
        {
            try
            {
                var casts = await MazeHelper.GetCasts(showId);

                using (var db = new MediaDbContext())
                {
                    foreach (var cast in casts)
                    {
                        if (await db.Persons.FindAsync(cast.Person.Id) == null)
                        {
                            await db.AddAsync(cast.Person);

                            await db.SaveChangesAsync();
                        }
                        await MapShowPerson(showId, cast.Person.Id);
                    }
                }
            }
            catch (Exception ex)
            {
                var message = ex.Message;
            }
        }