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>());
 }
Exemplo 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);
        }
Exemplo n.º 6
0
 public IQueryable <T> FindAll(bool trackChanges) =>
 !trackChanges?
 RepositoryContext.Set <T>()
 .AsNoTracking() :             // dont track the query when data change
     RepositoryContext.Set <T>();
Exemplo n.º 7
0
 public IQueryable <T> FindAll() => RepositoryContext.Set <T>();
Exemplo n.º 8
0
 public void Delete(T entity)
 {
     RepositoryContext.Set <T>().Remove(entity);
 }
Exemplo n.º 9
0
 public void Update(T entity)
 {
     RepositoryContext.Set <T>().Update(entity);
 }
Exemplo n.º 10
0
 public void Create <TDest>(TDest entity) where TDest : class
 {
     RepositoryContext.Set <TDest>().Add(entity);
 }
Exemplo n.º 11
0
 public async Task Create(T entity) =>
 await RepositoryContext.Set <T>().AddAsync(entity);
Exemplo n.º 12
0
 public void Create(T entity)
 {
     context.Set <T>().Add(entity);
 }
Exemplo n.º 13
0
 public IQueryable <T> FindAll(bool trackChanges) =>
 !trackChanges
         ? _repositoryContext.Set <T>()
 .AsNoTracking()
         : _repositoryContext.Set <T>();
Exemplo 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);
        }
Exemplo n.º 16
0
        public async Task <string> GetUniqueId()
        {
            int countOfRows = await RepositoryContext.Set <T>().AsQueryable().CountAsync();

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