コード例 #1
0
        public async Task <Utilisateur> GetUserDetailsAsync(string id)
        {
            var User = await _dbContext.User.SingleAsync(User => User.Id == id);

            _dbContext.Entry(User);



            return(User);
        }
コード例 #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();
            }
        }
コード例 #3
0
ファイル: ActiviteRepo.cs プロジェクト: Wissemkhass/TourMe
        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();
            }
        }
コード例 #4
0
ファイル: NourritureRepo.cs プロジェクト: Wissemkhass/TourMe
        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();
            }
        }
コード例 #5
0
ファイル: LogementRepo.cs プロジェクト: Wissemkhass/TourMe
        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();
            }
        }
コード例 #6
0
ファイル: RatingRepo.cs プロジェクト: Wissemkhass/TourMe
        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();
            }
        }
コード例 #7
0
ファイル: ExperienceRepo.cs プロジェクト: Wissemkhass/TourMe
        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);
        }