Exemple #1
0
        public async Task <DTO.Companies> GetAll(DTO.StdCollectionInputs sci)
        {
            System.Linq.IQueryable <ORMModel.Company> q = _db.Company;

            var retVal = new Companies();

            await retVal.Run(_mapper, q, sci);

            return(_mapper.Map <DTO.Companies>(retVal));
        }
        public async Task <DTO.MasterMaps> GetAll(DTO.StdCollectionInputs sci)
        {
            System.Linq.IQueryable <ORMModel.MasterMap> q = _db.MasterMap.Include(o => o.Columns);

            var retVal = new MasterMaps();

            await retVal.Run(_mapper, q, sci);

            return(_mapper.Map <DTO.MasterMaps>(retVal));
        }
Exemple #3
0
        public async Task <DTO.Persons> GetAll(DTO.StdCollectionInputs sci)
        {
            System.Linq.IQueryable <ORMModel.Person> q = _db.Person;

            var retVal = new Persons();

            await retVal.Run(_mapper, q, sci);

            return(_mapper.Map <DTO.Persons>(retVal));
        }
Exemple #4
0
        public async Task <DTO.Sales> GetAll(DTO.StdCollectionInputs sci)
        {
            System.Linq.IQueryable <ORMModel.Sale> q = _db.Sale;

            var c = new Sales();

            await c.Run(_mapper, q, sci);

            var retVal = _mapper.Map <DTO.Sales>(c);

            return(retVal);
        }
        public async Task Run(IMapper mapper, IQueryable <TEF> q, DTO.StdCollectionInputs sci)
        {
            var tq = q;

            if (!sci.IncludeDeleted)
            {
                tq = OrmHelper.EqualToProperty <TEF>(tq, "Deleted", false);
            }

            tq = AddSearchParameters(tq, sci);

            TotalCount = tq.Count();

            string sIncludeDeleted = sci.IncludeDeleted ? "true" : "false";

            string QM = sci.Route.IndexOf("?") == -1 ? "?" : "&";

            q = AddSearchParameters(q, sci);

            q = OrmHelper.AddStdCollectionParameters <TEF>(q, sci.Offset, sci.Limit, sci.IncludeDeleted,
                                                           sci.Sort);

            Items = mapper.Map <TDTO[]>(await q.ToArrayAsync());

            ItemCount = Items.Count();

            Paging.Self  = $"{sci.Offset}";
            Paging.First = $"0";

            if (sci.Limit < TotalCount && sci.Limit > 0)
            {
                if (sci.Offset > 0)
                {
                    Paging.Prev = $"{(sci.Offset > 0 ? sci.Offset - sci.Limit : 0)}";
                }

                if (sci.Offset < TotalCount)
                {
                    Paging.Next = $"{(sci.Offset + sci.Limit)}";

                    Paging.Last = $"{(TotalCount - sci.Limit)}";
                }

                if (sci.Offset + sci.Limit >= TotalCount)
                {
                    Paging.Next = null;
                }
            }
        }