Ejemplo n.º 1
0
        public async Task <Utilisateur> GetUserDetailsAsync(string id)
        {
            var User = await _dbContext.User.SingleAsync(User => User.Id == id);

            _dbContext.Entry(User);



            return(User);
        }
Ejemplo n.º 2
0
        public async Task PutAsync(int id, TEntity entity)
        {
            _dbContext.Entry(entity).State = EntityState.Modified;

            try
            {
                _dbContext.Update(entity);
                await _dbContext.SaveChangesAsync();
            }
            catch (Exception)
            {
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 3
0
        public async Task Update(Activite entity)
        {
            var Activite = await _dbContext.Activite.SingleAsync(e => e.activiteId == entity.activiteId);

            _dbContext.Entry(Activite).State = EntityState.Detached;
            _dbContext.Entry(entity).State   = EntityState.Modified;
            try
            {
                await _dbContext.SaveChangesAsync();
            }
            catch (Exception)
            {
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 4
0
        public async Task Update(Nourriture entity)
        {
            var nourriture = await _dbContext.Nourritures.FindAsync(entity.NourritureId);

            _dbContext.Entry(nourriture).State = EntityState.Detached;
            _dbContext.Entry(entity).State     = EntityState.Modified;
            try
            {
                await _dbContext.SaveChangesAsync();
            }
            catch (Exception)
            {
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 5
0
        public async Task Update(Logement entity)
        {
            var Logement = await dbContext.Logements.FindAsync(entity.LogementId);

            dbContext.Entry(Logement).State = EntityState.Detached;
            dbContext.Entry(entity).State   = EntityState.Modified;
            try
            {
                await dbContext.SaveChangesAsync();
            }
            catch (Exception)
            {
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 6
0
        public async Task Rater(Rating entity, int idE, string IdU, string rate)
        {
            var rating = await _dbContext.Ratings.SingleOrDefaultAsync(rat => rat.ExperienceId == entity.ExperienceId && rat.UtilisateurId == entity.UtilisateurId);

            rating.note = rate;
            _dbContext.Entry(rating).State = EntityState.Detached;
            _dbContext.Entry(entity).State = EntityState.Modified;

            try
            {
                await _dbContext.SaveChangesAsync();
            }
            catch (Exception)
            {
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 7
0
        public async Task <Experience> GetExperienceDetailsAsync(int id)
        {
            var Experience = await _dbContext.Experience.Include(x => x.Activites).SingleAsync(Experience => Experience.ExperienceId == id);

            _dbContext.Entry(Experience).Collection(experience => experience.Activites).Query().Load();
            _dbContext.Entry(Experience).Reference(x => x.Nourriture).Query().Load();
            _dbContext.Entry(Experience).Reference(experience => experience.Logement).Query().Load();
            _dbContext.Entry(Experience).Reference(experience => experience.Transport).Query().Load();
            _dbContext.Entry(Experience).Collection(experience => experience.Ratings).Query().Load();
            _dbContext.Entry(Experience).Collection(experience => experience.Ratings).Query().Include(x => x.utilisateur).Load();
            _dbContext.Entry(Experience).State = EntityState.Detached;

            return(Experience);
        }