Esempio n. 1
0
        public ActionResult <BaseViewModel <PagingResult <RoleViewModel> > > GetAll([FromQuery] BaseRequestViewModel request)
        {
            //var a = request.Filters[0];

            var data   = _roleManager.Roles.ToList();
            var result = new BaseViewModel <PagingResult <RoleViewModel> >();

            result.Data = new PagingResult <RoleViewModel>
            {
                Results      = _mapper.Map <IEnumerable <RoleViewModel> >(data),
                TotalRecords = data.Count,
            };

            return(result);
        }
Esempio n. 2
0
 public async Task <BaseViewModel <PagingResult <ProductViewModel> > > GetAllProductsNoPaging(BaseRequestViewModel request)
 {
     return(await GetAll(new BasePagingRequestViewModel
     {
         PageIndex = null,
         PageSize = null,
         Filter = request.Filter,
         Include = request.Include,
         SortBy = request.SortBy
     }, Constants.DEAFAULT_DELETE_STATUS_EXPRESSION));
 }
Esempio n. 3
0
 public async Task <BaseViewModel <PagingResult <OrderViewModel> > > GetAllOrdersByAdminNoPaging(BaseRequestViewModel request)
 {
     return(await GetAllOrder(new BasePagingRequestViewModel
     {
         Filter = request.Filter,
         Include = request.Include,
         SortBy = request.SortBy
     }));
 }
Esempio n. 4
0
        public async Task <BaseViewModel <PagingResult <LocationViewModel> > > GetAllLoctionsNoPaging(BaseRequestViewModel request)
        {
            var result = new BaseViewModel <PagingResult <LocationViewModel> >();

            string filter = SearchHelper <Location> .GenerateStringExpression(request.Filter, Constants.DEAFAULT_DELETE_STATUS_EXPRESSION);

            Expression <Func <Location, bool> > FilterExpression = await LinqHelper <Location> .StringToExpression(filter);

            QueryArgs <Location> queryArgs = new QueryArgs <Location>
            {
                Filter = FilterExpression,
                Sort   = request.SortBy,
            };


            var data = _repository.Get(queryArgs.Filter, queryArgs.Sort).ToList();

            //var sql = data.ToSql();

            if (data == null || data.Count == 0)
            {
                result.Description = MessageHandler.CustomMessage(MessageConstants.NO_RECORD);
                result.Code        = MessageConstants.NO_RECORD;
            }
            else
            {
                result.Data = new PagingResult <LocationViewModel>
                {
                    Results      = _mapper.Map <IEnumerable <LocationViewModel> >(data),
                    TotalRecords = _repository.Count(queryArgs.Filter)
                };
            }

            return(result);
        }
Esempio n. 5
0
        public async Task <ActionResult <BaseViewModel <PagingResult <LocationViewModel> > > > GetAllLocation([FromQuery] BaseRequestViewModel request)
        {
            //var a = request.Filters[0];

            var result = await _locationService.GetAllLoctionsNoPaging(request);

            this.HttpContext.Response.StatusCode = (int)result.StatusCode;

            return(result);
        }
Esempio n. 6
0
        public async Task <ActionResult <BaseViewModel <PagingResult <OrderViewModel> > > > GetAllOrder([FromQuery] BaseRequestViewModel request)
        {
            var result = await _orderService.GetAllOrdersByAdminNoPaging(request);

            HttpContext.Response.StatusCode = (int)result.StatusCode;
            return(result);
        }