Ejemplo n.º 1
0
        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
        }
Ejemplo n.º 2
0
        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
        }
Ejemplo n.º 3
0
 public async Task <int> SaveChanges(CancellationToken cancellationToken = default(CancellationToken))
 {
     try
     {
         return(await _context.SaveChangesAsync(cancellationToken));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 4
0
 public void Save()
 {
     _context.SaveChangesAsync();
 }
Ejemplo n.º 5
0
        //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();
        }