Ejemplo n.º 1
0
        public void AddScore(Score score)
        {
            if (score == null)
            {
                throw new ServiceException("Score must be not null!");
            }
            if (score.Name == null)
            {
                throw new ServiceException("Score contains null Name!");
            }

            using (var db = new SudokuContext())
            {
                db.Add(score);
                db.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        public void AddComment(Comment comment)
        {
            if (comment == null)
            {
                throw new ServiceException("Comment must be not null!");
            }
            if (comment.Name == null)
            {
                throw new ServiceException("Comment contains null Name!");
            }
            if (comment.Message == null)
            {
                throw new ServiceException("Comment contains null Message!");
            }

            using (var db = new SudokuContext())
            {
                db.Add(comment);
                db.SaveChanges();
            }
        }