Пример #1
0
 public async Task UpdatePositions(List <Positions> positions)
 {
     try
     {
         foreach (var position in positions)
         {
             db.Positions.AddOrUpdate(u => u.TeamId, position);
         }
         await db.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         Error.Message = "Error in UpdatePositions method: " + ex.Message;
     }
 }
Пример #2
0
        public void AddMany(List <Match> matches)
        {
            //db.Matches.AddRange(matches);
            //db.SaveChanges();

            try
            {
                foreach (var match in matches)
                {
                    db.Matches.AddOrUpdate(u => u.Id, match);
                }
                db.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                Error.Message = "Error al agregar o actualizar partidos: " + ex.Message;
            }
        }