public static void removeVote(int vote_id) { vote v = context.votes.Where(x => x.id_vote == vote_id).SingleOrDefault(); context.votes.Remove(v); context.SaveChanges(); }
public static vote getVote(int user_id, int project_id) { vote v = context.votes.Where(x => x.user_id == user_id && x.project_id == project_id).SingleOrDefault(); foreach (file f in v.project.files) { f.SerializeVirtualProperties = false; } return(v); }
public static vote postVote(int user_id, int project_id) { vote v = new vote(); v.id_vote = 0; v.date = DateTime.Now; v.user_id = user_id; v.project_id = project_id; context.votes.Add(v); context.SaveChanges(); return(context.votes.Where(x => x.project_id == v.project_id && x.user_id == v.user_id).SingleOrDefault()); }