public void ClearScores()
 {
     using (var context = new ReversiContext())
     {
         context.Database.ExecuteSqlCommand("DELETE FROM Scores");
     }
 }
 public void DeleteComment()
 {
     using (var context = new ReversiContext())
     {
         context.Database.ExecuteSqlCommand("DELETE FROM Comments");
     }
 }
 public void AddScore(Score score)
 {
     using (var context = new ReversiContext())
     {
         context.Scores.Add(score);
         context.SaveChanges();
     }
 }
 public void AddComment(Comment comment)
 {
     using (var context = new ReversiContext())
     {
         context.Add(comment);
         context.SaveChanges();
     }
 }
Esempio n. 5
0
 public int GetRating()
 {
     using (var context = new ReversiContext())
     {
         // return context.Database.ExecuteSqlCommand("SELECT AVG(rating) FROM Rating ");
         int a = (int)(from s in context.Ratings select s.rating).Average();
         return(a);
     }
 }
Esempio n. 6
0
        public void AddRating(Rating rating)
        {
            using (var context = new ReversiContext())
            {
                context.Add(rating);

                context.SaveChanges();
            }
        }
 public List <Score> GetTopScores()
 {
     using (var context = new ReversiContext())
     {
         return((from s in context.Scores
                 orderby s.Points
                 descending
                 select s).Take(5).ToList());
     }
 }
        public List <Comment> GetComments()

        {
            using (var context = new ReversiContext())
            {
                //context.Database.ExecuteSqlCommand("SELECT * FROM Comments");
                return((from s in context.Comments
                        orderby s.Coment

                        select s).ToList());
            }
        }