public IHttpActionResult Get()
 {
     using (ApplicationDbContext db = new ApplicationDbContext())
     {
         List <PostViewModel> posts = new List <PostViewModel>();
         foreach (var x in db.Posts.ToList())
         {
             PostViewModel pvm = ApplicationUtils.CreatePostViewModel(x);
             pvm.Likes    = 0;
             pvm.Dislikes = 0;
             pvm.Likes    = db.Database.SqlQuery <int>("SELECT COUNT(*) FROM Users_Posts_Like WHERE Post_id = {0}", pvm.Id).First();
             pvm.Dislikes = db.Database.SqlQuery <int>("SELECT COUNT(*) FROM Users_Posts_Dislike WHERE Post_id = {0}", pvm.Id).First();
             posts.Add(pvm);
         }
         return(Ok(new { Posts = posts }));
     }
 }