Esempio n. 1
0
        public IHttpActionResult Get()
        {
            try
            {
                List <UserCouponPackageVM> result = AutoMapper.Mapper.Map <List <UserCouponPackage>, List <UserCouponPackageVM> >
                                                        (_userCouponPackageService.GetAllUserCouponPackage().ToList());

                return(Ok(result));
            }
            catch (Exception e)
            {
                return(InternalServerError(e));
            }
        }
Esempio n. 2
0
        public IHttpActionResult GetAll(int pageIndex)
        {
            try
            {
                List <UserCouponPackageVM> resultVMs = AutoMapper.Mapper.Map <List <UserCouponPackage>, List <UserCouponPackageVM> >
                                                           (_userCouponPackageService.GetAllUserCouponPackage(_ => _.CouponItems)
                                                           .Where(_ => _.UserId == CURRENT_USER_ID)
                                                           .ToList());

                Pager <UserCouponPackageVM> result = _pagination.ToPagedList <UserCouponPackageVM>(pageIndex, ConstantDataManager.PAGESIZE, resultVMs);
                return(Ok(result));
            }
            catch (Exception e)
            {
                return(InternalServerError(e));
            }
        }