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 Acceleration Save(Acceleration acceleration) { if (acceleration.Id == 0) { _context.Add(acceleration); _context.SaveChanges(); } return(acceleration); }
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 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 Candidate Save(Candidate candidate) { try { var findCandidate = FindById(candidate.UserId, candidate.AccelerationId, candidate.CompanyId); return(findCandidate); } catch (Exception) { _context.Add(candidate); _context.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) { 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 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) { Candidate candidateResult = FindById(candidate.UserId, candidate.AccelerationId, candidate.CompanyId); if (candidateResult == null) { _context.Add(candidate); candidateResult = candidate; } else { candidateResult.Status = candidate.Status; candidateResult.CreatedAt = candidate.CreatedAt; } _context.SaveChanges(); return(candidate); }
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 Submission Save(Submission submission) { Submission submissionResult = _context.Submissions .FirstOrDefault(s => s.UserId == submission.UserId && s.ChallengeId == submission.ChallengeId); if (submissionResult == null) { _context.Add(submission); submissionResult = submission; } else { submissionResult.Score = submission.Score; submissionResult.CreatedAt = submission.CreatedAt; } _context.SaveChanges(); return(submission); }
public Submission Save(Submission submission) { Submission su = _context.Submissions.FirstOrDefault(x => x.UserId == submission.UserId && x.ChallengeId == submission.ChallengeId); if (su == null) { _context.Add(submission); } else { _context.Entry(_context.Submissions .FirstOrDefault(x => x.UserId == submission.UserId && x.ChallengeId == submission.ChallengeId)) .CurrentValues.SetValues(submission); } _context.SaveChanges(); return(submission); }
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 Candidate Save(Candidate candidate) { //var state = _contexto.Entry(candidate).State; var existe = _contexto.Candidates.Find(candidate.AccelerationId, candidate.CompanyId, candidate.UserId); if (existe == null) { _contexto.Add(candidate); } else { //_contexto.Update(candidate); existe.Status = candidate.Status; } _contexto.SaveChanges(); return(candidate); }
public Submission Save(Submission submission) { // var state = _contexto.Entry(submission).State; var existe = _contexto.Submissions.Find(submission.ChallengeId, submission.UserId); if (existe == null) { _contexto.Add(submission); } else { //_contexto.Update(submission); existe.Score = submission.Score; } _contexto.SaveChanges(); return(submission); }
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) { Candidate ca = _context.Candidates .FirstOrDefault(x => x.UserId == candidate.UserId && x.AccelerationId == candidate.AccelerationId && x.CompanyId == candidate.CompanyId); if (ca == null) { _context.Add(candidate); } else { _context.Entry(_context.Candidates .FirstOrDefault(x => x.UserId == candidate.UserId && x.AccelerationId == candidate.AccelerationId && x.CompanyId == candidate.CompanyId)) .CurrentValues.SetValues(candidate); } _context.SaveChanges(); return(candidate); }
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); }