// update if scoring is complete public static void UpdateProposal(Proposal proposal) { ARCCproposalsDbContext db = new ARCCproposalsDbContext(); db.Entry(proposal).State = EntityState.Modified; db.SaveChanges(); }
public static void UpdateScore(Score score) { ARCCproposalsDbContext db = new ARCCproposalsDbContext(); db.Entry(score).State = EntityState.Modified; db.SaveChanges(); }
public static Proposal GetProposal(int?id) { ARCCproposalsDbContext db = new ARCCproposalsDbContext(); Proposal proposal = new Proposal(); proposal = db.proposals.Find(id); return(proposal); }
public static Criteria GetCriteria(int?id) { ARCCproposalsDbContext db = new ARCCproposalsDbContext(); var crit = db.criterias.Find(id); //crit.ratingsSugg = crit.ratingsSugg.Replace("~", "\n"); return(crit); }
public static int GetUserId(string email) { ARCCproposalsDbContext db = new ARCCproposalsDbContext(); List <User> users = new List <User>(); users = db.Users.ToList(); foreach (User user in users) { if (user.email == email) { return(user.Id); } } return(0); }
public static List <Score> GetProposalScores(int?propId) { ARCCproposalsDbContext db = new ARCCproposalsDbContext(); List <Score> allScores = new List <Score>(); List <Score> scorz = new List <Score>(); //int numScrz = 0; allScores = db.scores.ToList(); foreach (Score s in allScores) { if (s.proposalId == propId) { //numScrz++; scorz.Add(s); } } //Debug.Write("Number of scores in results: " + scorz.Count); return(scorz); }
// return a list of all existing ids for populating main list public static List <int> GetProposalIds() { ARCCproposalsDbContext db = new ARCCproposalsDbContext(); var props = db.proposals.ToList(); List <int> propIds = new List <int>(); if (props == null) { Debug.Write("proposals is empty"); } else { foreach (Proposal p in props) { propIds.Add(p.Id); } } return(propIds); }
public static bool CreateUser(User user) { ARCCproposalsDbContext db = new ARCCproposalsDbContext(); List <User> users = new List <User>(); users = db.Users.ToList(); bool userExists = false; foreach (User u in users) { if (user.email == u.email) { userExists = true; } } if (!userExists) { db.Users.Add(user); db.SaveChanges(); return(true); } return(false); }
public static void Dispose() { ARCCproposalsDbContext db = new ARCCproposalsDbContext(); db.Dispose(); }