private IList <DiscussionEntryReturnType> GetUserJoined(Expression <Func <DiscussionEntry, bool> > expression, Func <IQueryable <DiscussionEntryReturnType>, IQueryable <DiscussionEntryReturnType> > fun = null)
        {
            IQueryable <DiscussionEntryReturnType> v = RepositoryContext.Set <DiscussionEntry>().Where(expression).Join(RepositoryContext.Users,
                                                                                                                        discussionEntry => discussionEntry.UserId,
                                                                                                                        user => user.Id,
                                                                                                                        (discussionEntry, user) => new DiscussionEntryReturnType()
            {
                Id          = discussionEntry.Id,
                Topic       = discussionEntry.Topic,
                Text        = discussionEntry.Text,
                TimeStamp   = discussionEntry.TimeStamp,
                Subgroup    = discussionEntry.Subgroup,
                NormalGroup = discussionEntry.NormalGroup,
                UserId      = discussionEntry.UserId,
                AnswerTo    = discussionEntry.AnswerTo,
                File        = discussionEntry.File,
                UserName    = user.UserName,
                AnswerCount = RepositoryContext.DiscussionEntries.Count(uts => uts.AnswerTo == discussionEntry.Id)
            }).OrderBy(uts => uts.TimeStamp);

            if (fun != null)
            {
                v = fun(v);
            }
            return(v.ToList());
        }
 public IQueryable <T> FindAll(bool trackChanges)
 {
     return(!trackChanges?
            RepositoryContext.Set <T>()
            .AsNoTracking() :
                RepositoryContext.Set <T>());
 }
Esempio n. 3
0
        public async Task <IEnumerable <Element> > GetAllElementsInDrawingAsync(Guid guid)
        {
            var elements = await RepositoryContext.Set <Element>()
                           .Where(e => e.IdDrawing.Equals(guid) && !e.Status.Equals("Deleted"))
                           .Include(e => e.ElementManagement)
                           .ThenInclude(m => m.GeometryVersions).ToListAsync();

            return(elements);
        }
        public async Task <IEnumerable <ElementManagement> > GetAllInDrawingAsync(Guid drawing)
        {
            var eleManas = await RepositoryContext.Set <ElementManagement>()
                           .Include(x => x.GeometryVersions)
                           .Include(x => x.Elements)
                           .Where(x => x.Elements.Any(e => e.IdDrawing.Equals(drawing))).ToListAsync();

            return(eleManas);
        }
        public async Task <IEnumerable <ElementManagement> > GetAllExeptAsync(Guid drawingExcept)
        {
            var eleManas = await RepositoryContext.Set <ElementManagement>()
                           .Include(x => x.GeometryVersions)
                           .Include(x => x.Elements)
                           .ThenInclude(e => e.Drawing)
                           .Where(x => x.Status.Equals("Normal") && !x.Elements.Any(e => e.IdDrawing.Equals(drawingExcept))).ToListAsync();

            return(eleManas);
        }
Esempio n. 6
0
 public IQueryable <T> FindAll(bool trackChanges) =>
 !trackChanges?
 RepositoryContext.Set <T>()
 .AsNoTracking() :             // dont track the query when data change
     RepositoryContext.Set <T>();
Esempio n. 7
0
 public IQueryable <T> FindAll() => RepositoryContext.Set <T>();
Esempio n. 8
0
 public void Delete(T entity)
 {
     RepositoryContext.Set <T>().Remove(entity);
 }
Esempio n. 9
0
 public void Update(T entity)
 {
     RepositoryContext.Set <T>().Update(entity);
 }
Esempio n. 10
0
 public void Create <TDest>(TDest entity) where TDest : class
 {
     RepositoryContext.Set <TDest>().Add(entity);
 }
Esempio n. 11
0
 public async Task Create(T entity) =>
 await RepositoryContext.Set <T>().AddAsync(entity);
Esempio n. 12
0
 public void Create(T entity)
 {
     context.Set <T>().Add(entity);
 }
 public IQueryable <T> FindAll(bool trackChanges) =>
 !trackChanges
         ? _repositoryContext.Set <T>()
 .AsNoTracking()
         : _repositoryContext.Set <T>();
Esempio n. 14
0
 public IQueryable <T> FindAll(bool trackChanges = false) =>
 !trackChanges?
 RepositoryContext.Set <T>()
 .AsNoTracking() :
     RepositoryContext.Set <T>();
        public async Task <IEnumerable <ElementManagement> > GetAllAsync()
        {
            var eleManas = await RepositoryContext.Set <ElementManagement>().Include(x => x.GeometryVersions).Include(x => x.Elements).ToListAsync();

            return(eleManas);
        }
Esempio n. 16
0
        public async Task <string> GetUniqueId()
        {
            int countOfRows = await RepositoryContext.Set <T>().AsQueryable().CountAsync();

            return(typeof(T).Name.ToUpper() + countOfRows);
        }
Esempio n. 17
0
 public async Task <long> NumOfRecord()
 {
     return(await RepositoryContext.Set <T>().AsQueryable().CountAsync());
 }
Esempio n. 18
0
 public void Add(TEntity entity)
 {
     _dbContext.Set <TEntity>().Add(entity);
 }
Esempio n. 19
0
 public IQueryable <T> FindAll()
 {
     return(RepositoryContext.Set <T>().AsNoTracking());
 }
Esempio n. 20
0
 public void Create(T entity) => RepositoryContext.Set <T>().Add(entity);
Esempio n. 21
0
 public IQueryable <T> FindByCondition(Expression <Func <T, bool> > expression)
 {
     return(RepositoryContext.Set <T>().Where(expression));//.AsNoTracking();
 }