public IActionResult Candidates() { APIHandler webHandler = new APIHandler(); Candidates candidates = webHandler.GetCandidates(); foreach (var item in candidates.results) { if (dbContext.Candidates.Where(c => c.candidate_id.Equals(item.candidate_id)).Count() == 0) { dbContext.Candidates.Add(item); } } dbContext.SaveChanges(); return(View(candidates)); }
public void Save() { _electionContext.SaveChanges(); }
public virtual T Add(T t) { _dbSet.Add(t); _context.SaveChanges(); return(t); }