public static rating getRatingsWhereAuthor(int user_id, int project_id)
        {
            rating rating = context.ratings.Where(x => x.user_id == user_id && x.project_id == project_id).SingleOrDefault();

            foreach (file f in rating.project.files)
            {
                f.SerializeVirtualProperties = false;
            }
            return(rating);
        }
 public static rating putRating(rating r)
 {
     if (r.id_rating != 0 || context.ratings.Where(x => x.project_id == r.project_id && x.user_id == r.user_id).SingleOrDefault() != null)
     {
         context.ratings.Where(x => x.project_id == r.project_id && x.user_id == r.user_id).SingleOrDefault().rate    = r.rate;
         context.ratings.Where(x => x.project_id == r.project_id && x.user_id == r.user_id).SingleOrDefault().comment = r.comment;
     }
     else
     {
         context.ratings.Add(r);
     }
     if (r.project != null)
     {
         r.project.SerializeVirtualProperties = false;
     }
     context.SaveChanges();
     return(context.ratings.Where(x => x.id_rating == r.id_rating).SingleOrDefault());
 }