예제 #1
0
        public async Task <ActionResult <PublicApi.v1.DTO.Defect> > GetDefect(int id)
        {
            var defect = await _bll.Defects.FindProductsWithDefectByShopAsync(id, User.GetShopId());

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

            return(DefectMapper.MapFromBLL(defect));
        }
예제 #2
0
        public async Task <ActionResult <IEnumerable <PublicApi.v1.DTO.Defect> > > GetDefects(string search, int?pageIndex, int?pageSize)
        {
            if ((pageIndex != null && pageIndex < 1) || (pageSize != null && pageSize < 1))
            {
                return(BadRequest());
            }
            var defect = (await _bll.Defects.GetAllWithProductsWithDefectByShopAsync(User.GetShopId(), search, pageIndex, pageSize)).Select(e => DefectMapper.MapFromBLL(e)).ToList();

            return(defect);
        }