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)); }
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); }