Example #1
0
        public void Delete(int id)
        {
            var match = context.Match.Find(id);

            if (match != null)
            {
                var pronostics = context.Pronostic.Where(p => p.IdMatch == match.Id);
                foreach (Pronostic p in pronostics)
                {
                    context.Remove(p);
                }
                context.Match.Remove(match);
                context.SaveChanges();
            }
        }
Example #2
0
        public void Delete(int id)
        {
            var user = context.User.Find(id);

            if (user != null)
            {
                var pronostics = context.Pronostic.Where(p => p.IdUser == user.Id);
                foreach (Pronostic p in pronostics)
                {
                    context.Remove(p);
                }
                context.User.Remove(user);
                context.SaveChanges();
            }
        }