public async Task <ActionResult <Candidat> > PostCandidate([FromBody] Candidat candidat) { // Adding the candidate object to the database rhContext.Candidat.Add(candidat); await rhContext.SaveChangesAsync(); // ReSynchronizing the database just after insertion return(CreatedAtAction(nameof(GetCandidateAsync), new { id = candidat.IdCandidat }, candidat)); // return the created action }
public async Task <ActionResult <Direction> > PostDirection([FromBody] Direction direction) { // Adding the direction object to the database rhContext.Direction.Add(direction); await rhContext.SaveChangesAsync(); // ReSynchronizing the database just after insertion return(CreatedAtAction(nameof(GetDirectionByIdAsync), new { id = direction.IdDirection }, direction)); // return the created action }
public async Task <int> SaveChanges(CancellationToken cancellationToken = default(CancellationToken)) { try { return(await _context.SaveChangesAsync(cancellationToken)); } catch (Exception e) { throw e; } }
public void Save() { _context.SaveChangesAsync(); }
//public GenericRepository<Persona> PersonaRepository //{ // get // { // if (this.personaRepository == null) // { // this.personaRepository = new GenericRepository<Persona>(_context); // } // return personaRepository; // } //} //public CourseRepository CourseRepository //{ // get // { // if (this.courseRepository == null) // { // this.courseRepository = new CourseRepository(context); // } // return courseRepository; // } //} public async Task Save() { await _context.SaveChangesAsync(); }