public Submission Save(Submission submission) { var existe = _context.Submissions.Find(submission.UserId, submission.ChallengeId) == null ? _context.Add(submission) : _context.Update(submission.Score); _context.SaveChanges(); return(submission); }
public User Save(User user) { if (user.Id.Equals(0)) { data.Add(user); } else { data.Update(user); } data.SaveChanges(); return(user); }
public Company Save(Company company) { if (_context.Companies.Any(x => x == company)) { _context.Update(company); } else { _context.Add(company); } _context.SaveChanges(); return(company); }
public Models.Challenge Save(Models.Challenge challenge) { if (challenge.Id == 0) { data.Add(challenge); } else { data.Update(challenge); } data.SaveChanges(); return(challenge); }
public Acceleration Save(Acceleration acceleration) { if (acceleration.Id == 0) { data.Add(acceleration); } else { data.Update(acceleration); } data.SaveChanges(); return(acceleration); }
public Models.Challenge Save(Models.Challenge challenge) { if (_context.Challenges.Any(x => x == challenge)) { _context.Update(challenge); } else { _context.Add(challenge); } _context.SaveChanges(); return(challenge); }
public Acceleration Save(Acceleration acceleration) { if (_context.Accelerations.Any(x => x == acceleration)) { _context.Update(acceleration); } else { _context.Add(acceleration); } _context.SaveChanges(); return(acceleration); }
public User Save(User user) { if (_context.Users.Any(x => x == user)) { _context.Update(user); } else { _context.Add(user); } _context.SaveChanges(); return(user); }
public Company Save(Company company) { if (company.Id == 0) { data.Add(company); } else { data.Update(company); } data.SaveChanges(); return(company); }
public User Save(User user) { if (user.Id == 0) { _context.Add(user); _context.SaveChanges(); } else { _context.Update(user); } return(user); }
public Candidate Save(Candidate candidate) { if (MustInclude(candidate)) { _context.Set <Candidate>().Add(candidate); } else { _context.Update <Candidate>(candidate); } _context.SaveChanges(); return(candidate); }
public Models.Challenge Save(Models.Challenge challenge) { if (challenge.Id == 0) { _context.Add(challenge); _context.SaveChanges(); } else { _context.Update(challenge); } return(challenge); }
public Acceleration Save(Acceleration acceleration) { if (acceleration.Id == 0) { _context.Add(acceleration); } else { _context.Update(acceleration); } _context.SaveChanges(); return(acceleration); }
public Company Save(Company company) { if (company.Id == 0) { _context.Add(company); } else { _context.Update(company); } _context.SaveChanges(); return(company); }
public Submission Save(Submission submission) { Submission submissionExists = data.Submissions.Find(submission.UserId, submission.ChallengeId); if (submissionExists == null) { data.Add(submission); } else { data.Entry(submissionExists).State = EntityState.Detached; data.Update(submission); } data.SaveChanges(); return(submission); }
public Candidate Save(Candidate candidate) { Candidate candidateExists = FindById(candidate.UserId, candidate.AccelerationId, candidate.CompanyId); if (candidateExists == null) { data.Add(candidate); } else { data.Entry(candidateExists).State = EntityState.Detached; data.Update(candidate); } data.SaveChanges(); return(candidate); }
public Submission Save(Submission submission) { var search = _context.Submissions.Where(x => x.UserId == submission.UserId && x.ChallengeId == submission.ChallengeId).FirstOrDefault(); if (search == null) { _context.Add(submission); _context.SaveChanges(); } else { _context.Update(submission); } return(submission); }
public Submission Save(Submission submission) { var submissionFromContext = _context.Submissions.Find(submission.UserId, submission.ChallengeId); if (submissionFromContext == null) { _context.Add(submission); } else { _context.Entry(submissionFromContext).State = EntityState.Detached; _context.Update(submission); } _context.SaveChanges(); return(submission); }
public Candidate Save(Candidate candidate) { var candidateFromContext = _context.Candidates.Find(candidate.UserId, candidate.AccelerationId, candidate.CompanyId); if (candidateFromContext == null) { _context.Add(candidate); } else { _context.Entry(candidateFromContext).State = EntityState.Detached; _context.Update(candidate); } _context.SaveChanges(); return(candidate); }
public Company Save(Company company) { var state = _contexto.Entry(company).State; var existe = _contexto.Companies.AsNoTracking().Where(x => x.Id == company.Id); if (existe == null) { _contexto.Add(company); } else { _contexto.Update(company); } _contexto.SaveChanges(); return(company); }
public Submission Save(Submission submission) { var submissionExists = _context .Submissions .Any(s => s.UserId == submission.UserId && s.ChallengeId == submission.ChallengeId); if (submissionExists) { _context.Update(submission); } else { _context.Add(submission); } _context.SaveChanges(); return(submission); }
public Candidate Save(Candidate candidate) { var candidateExists = _context .Candidates .Any(x => x.UserId == candidate.UserId && x.AccelerationId == candidate.AccelerationId && x.CompanyId == candidate.CompanyId); if (!candidateExists) { _context.Add(candidate); } else { _context.Update(candidate); } _context.SaveChanges(); return(candidate); }