Example #1
0
        public async Task <ActionResult <PublicApi.v1.DTO.Sale> > GetSale(int id)
        {
            var sale = await _bll.Sales.GetAsyncByShopAndIdDTO(id, User.GetShopId());

            if (sale == null)
            {
                return(NotFound());
            }

            return(SaleMapper.MapFromBLL(sale));
        }
Example #2
0
        public async Task <ActionResult <IEnumerable <PublicApi.v1.DTO.Sale> > > GetSales(string search, int?pageIndex, int?pageSize)
        {
            if ((pageIndex != null && pageIndex < 1) || (pageSize != null && pageSize < 1))
            {
                return(BadRequest());
            }
            var sale = (await _bll.Sales.AllAsyncByShopDTO(User.GetShopId(), search, pageIndex, pageSize)).Select(e => SaleMapper.MapFromBLL(e)).ToList();

            return(sale);
        }