Beispiel #1
0
        private void AddOrUpdate(ExcelMatch match)
        {
            using (var context = _dataContextFactory.Create())
            {
                var existing = (from m in context.Matcher
                                where m.MatchId == match.MatchId
                                select m).FirstOrDefault();

                if (existing == null)
                {
                    context.Matcher.Add(match.GetMatch());
                }
                else
                {
                    match.Update(existing);
                }

                context.SaveChanges();
            }
        }
        private void AddOrUpdate(ExcelMatch match)
        {
            using (var context = _dataContextFactory.Create())
            {
                var existing = (from m in context.Matcher
                                where m.MatchId == match.MatchId
                                select m).FirstOrDefault();

                if (existing == null)
                {
                    context.Matcher.Add(match.GetMatch());
                }
                else
                {
                    match.Update(existing);
                }

                context.SaveChanges();
            }
        }