Esempio n. 1
0
        public async Task <TurmaParticipante> GetById(TurmaParticipanteFilter model)
        {
            var _turmaparticipante = await this.SingleOrDefaultAsync(this.GetAll(this.DataAgregation(model))
                                                                     .Where(_ => _.TurmaParticipanteId == model.TurmaParticipanteId));

            return(_turmaparticipante);
        }
Esempio n. 2
0
        public async Task <dynamic> GetDataCustom(TurmaParticipanteFilter filters)
        {
            var querybase = await this.ToListAsync(this.GetBySimplefilters(filters).Select(_ => new
            {
                Id = _.TurmaParticipanteId
            }));

            return(querybase);
        }
Esempio n. 3
0
        public async Task <PaginateResult <dynamic> > GetDataListCustomPaging(TurmaParticipanteFilter filters)
        {
            var querybase = await this.PagingDataListCustom <dynamic>(filters, this.GetBySimplefilters(filters).Select(_ => new
            {
                Id = _.TurmaParticipanteId
            }));

            return(querybase);
        }
Esempio n. 4
0
        public IQueryable <TurmaParticipante> GetBySimplefilters(TurmaParticipanteFilter filters)
        {
            var querybase = this.GetAll(this.DataAgregation(filters))
                            .WithBasicFilters(filters)
                            .WithCustomFilters(filters)
                            .OrderByDomain(filters)
                            .OrderByProperty(filters);

            return(querybase);
        }
        public async Task <IActionResult> Get([FromQuery] TurmaParticipanteFilter filters)
        {
            var result = new HttpResult <TurmaParticipanteDto>(this._logger);

            try
            {
                var searchResult = await this._app.GetByFilters(filters);

                return(result.ReturnCustomResponse(this._app, searchResult, filters));
            }
            catch (Exception ex)
            {
                var responseEx = result.ReturnCustomException(ex, "Seed - TurmaParticipante", filters, new ErrorMapCustom());
                return(responseEx);
            }
        }
        public async Task <IActionResult> Get(int id, [FromQuery] TurmaParticipanteFilter filters)
        {
            var result = new HttpResult <TurmaParticipanteDto>(this._logger);

            try
            {
                if (id.IsSent())
                {
                    filters.TurmaParticipanteId = id;
                }
                var returnModel = await this._app.GetOne(filters);

                return(result.ReturnCustomResponse(this._app, returnModel));
            }
            catch (Exception ex)
            {
                var responseEx = result.ReturnCustomException(ex, "Seed - TurmaParticipante", id);
                return(responseEx);
            }
        }
        public virtual Task <PaginateResult <TurmaParticipante> > GetByFiltersPaging(TurmaParticipanteFilter filters)
        {
            var queryBase = this._rep.GetBySimplefilters(filters);

            return(this._rep.PagingAndDefineFields(filters, queryBase));
        }
        public virtual async Task <IEnumerable <TurmaParticipante> > GetByFilters(TurmaParticipanteFilter filters)
        {
            var queryBase = this._rep.GetBySimplefilters(filters);

            return(await this._rep.ToListAsync(queryBase));
        }
 public virtual async Task <TurmaParticipante> GetOne(TurmaParticipanteFilter filters)
 {
     return(await this._rep.GetById(filters));
 }
        public static IQueryable <TurmaParticipante> WithBasicFilters(this IQueryable <TurmaParticipante> queryBase, TurmaParticipanteFilter filters)
        {
            var queryFilter = queryBase;

            if (filters.Ids.IsSent())
            {
                queryFilter = queryFilter.Where(_ => filters.GetIds().Contains(_.TurmaParticipanteId));
            }

            if (filters.TurmaParticipanteId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.TurmaParticipanteId == filters.TurmaParticipanteId);
            }
            if (filters.ParticipanteId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.ParticipanteId == filters.ParticipanteId);
            }
            if (filters.TurmaId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.TurmaId == filters.TurmaId);
            }


            return(queryFilter);
        }
Esempio n. 11
0
        public async Task <IActionResult> Get([FromQuery] TurmaParticipanteFilter filters)
        {
            var result = new HttpResult <dynamic>(this._logger);

            try
            {
                if (filters.FilterBehavior == FilterBehavior.GetDataItem)
                {
                    var searchResult = await this._rep.GetDataItem(filters);

                    return(result.ReturnCustomResponse(searchResult, filters));
                }

                if (!this._user.GetClaims().GetTools().VerifyClaimsCanRead("TurmaParticipante"))
                {
                    return(new ObjectResult(null)
                    {
                        StatusCode = (int)HttpStatusCode.Forbidden
                    });
                }


                if (filters.FilterBehavior == FilterBehavior.GetDataCustom)
                {
                    var searchResult = await this._rep.GetDataCustom(filters);

                    return(result.ReturnCustomResponse(searchResult, filters));
                }

                if (filters.FilterBehavior == FilterBehavior.GetDataListCustom)
                {
                    var searchResult = await this._rep.GetDataListCustom(filters);

                    return(result.ReturnCustomResponse(searchResult, filters));
                }

                if (filters.FilterBehavior == FilterBehavior.GetDataListCustomPaging)
                {
                    var paginatedResult = await this._rep.GetDataListCustomPaging(filters);

                    return(result.ReturnCustomResponse(paginatedResult.ToSearchResult <dynamic>(), filters));
                }


                if (filters.FilterBehavior == FilterBehavior.Export)
                {
                    var searchResult = await this._rep.GetDataListCustom(filters);

                    var export = new ExportExcelCustom <dynamic>(filters);
                    var file   = export.ExportFile(this.Response, searchResult, "TurmaParticipante", this._env.RootPath);
                    return(File(file, export.ContentTypeExcel(), export.GetFileName()));
                }

                throw new InvalidOperationException("invalid FilterBehavior");
            }
            catch (Exception ex)
            {
                var responseEx = result.ReturnCustomException(ex, "Seed - TurmaParticipante", filters, new ErrorMapCustom());
                return(responseEx);
            }
        }
 public static IQueryable <TurmaParticipante> OrderByDomain(this IQueryable <TurmaParticipante> queryBase, TurmaParticipanteFilter filters)
 {
     return(queryBase.OrderBy(_ => _.TurmaParticipanteId));
 }
        public static IQueryable <TurmaParticipante> WithCustomFilters(this IQueryable <TurmaParticipante> queryBase, TurmaParticipanteFilter filters)
        {
            var queryFilter = queryBase;


            return(queryFilter);
        }