public async Task <ActionResult <IEnumerable <PublicApi.v1.DTO.ProductWithDefect> > > GetInfoByDefectId(int id)
        {
            var productsWithDefect = (await _bll.ProductsWithDefect.AllAsyncByShopAndDefectIdDTO(id, User.GetShopId()))
                                     .Select(e => ProductWithDefectMapper.MapFromBLL(e)).ToList();

            return(productsWithDefect);
        }
        public async Task <ActionResult <PublicApi.v1.DTO.ProductWithDefect> > GetProductWithDefect(int id)
        {
            var productWithDefect = await _bll.ProductsWithDefect.GetAsyncByShopAndIdDTO(id, User.GetShopId());

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

            return(ProductWithDefectMapper.MapFromBLL(productWithDefect));
        }
 public override async Task <List <DTO.DomainLikeDTO.ProductWithDefect> > AllAsync()
 {
     return(await RepositoryDbSet
            .Include(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations)
            .Include(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations)
            .Include(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations)
            .Include(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations)
            .Include(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations)
            .Include(d => d.Defect).ThenInclude(aa => aa.Description).ThenInclude(t => t.Translations)
            .Select(e => ProductWithDefectMapper.MapFromDomain(e)).ToListAsync());
 }
        public async Task <IActionResult> PutProductWithDefect(int id, PublicApi.v1.DTO.ProductWithDefect productWithDefect)
        {
            if (!ModelState.IsValid || id != productWithDefect.Id)
            {
                return(BadRequest());
            }

            _bll.ProductsWithDefect.Update(ProductWithDefectMapper.MapFromExternal(productWithDefect));
            await _bll.SaveChangesAsync();

            return(NoContent());
        }
        public override async Task <DTO.DomainLikeDTO.ProductWithDefect> FindAsync(params object[] id)
        {
            var productWithDefect = await RepositoryDbSet.FindAsync(id);

            return(ProductWithDefectMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == productWithDefect.Id)
                                                         .Include(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations)
                                                         .Include(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations)
                                                         .Include(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations)
                                                         .Include(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations)
                                                         .Include(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations)
                                                         .Include(d => d.Defect).ThenInclude(aa => aa.Description).ThenInclude(t => t.Translations)
                                                         .FirstOrDefaultAsync()));
        }
Ejemplo n.º 6
0
 public async Task <List <DTO.ProductWithDefect> > AllAsyncByShopAndDefectIdDTO(int id, int?shopId)
 {
     return((await Uow.ProductsWithDefect.AllAsyncByShopAndDefectIdDTO(id, shopId)).Select(e => ProductWithDefectMapper.MapFromDAL(e)).ToList());
 }
Ejemplo n.º 7
0
 public async Task <List <ProductIdName> > AllAsyncByDefectIdAndShopId(int defectId, int?shopId)
 {
     return((await Uow.ProductsWithDefect.AllAsyncByDefectIdAndShopId(defectId, shopId))
            .Select(e => ProductWithDefectMapper.MapFromDAL(e)).ToList());
 }
Ejemplo n.º 8
0
 public async Task <DTO.ProductWithDefect> GetAsyncByShopAndIdDTO(int id, int?shopId)
 {
     return(ProductWithDefectMapper.MapFromDAL(await Uow.ProductsWithDefect.GetAsyncByShopAndIdDTO(id, shopId)));
 }
Ejemplo n.º 9
0
 public override async Task <ProductWithDefect> FindAsync(params object[] id)
 {
     return(ProductWithDefectMapper.MapFromDAL(await Uow.ProductsWithDefect.FindAsync(id)));
 }
Ejemplo n.º 10
0
        /*public override async Task<IEnumerable<ProductWithDefect>> AllAsync()
         * {
         *  return await UOW.ProductsWithDefect.AllAsync();
         * }
         *
         * public override async Task<ProductWithDefect> FindAsync(params object[] id)
         * {
         *  return await UOW.ProductsWithDefect.FindAsync(id);
         * }
         *
         * public async Task<IEnumerable<ProductWithDefect>> AllAsyncByShop(int? shopId)
         * {
         *  return await UOW.ProductsWithDefect.AllAsyncByShop(shopId);
         * }
         *
         * public async Task<IEnumerable<ProductWithDefectDTO>> AllAsyncByShopDTO(int? shopId)
         * {
         *  return await UOW.ProductsWithDefect.AllAsyncByShopDTO(shopId);
         * }
         *
         * public async Task<ProductWithDefectDTO> GetAsyncByShopAndIdDTO(int id, int? shopId)
         * {
         *  return await UOW.ProductsWithDefect.GetAsyncByShopAndIdDTO(id, shopId);
         * }*/

        public override async Task <List <ProductWithDefect> > AllAsync()
        {
            return((await Uow.ProductsWithDefect.AllAsync()).Select(e => ProductWithDefectMapper.MapFromDAL(e)).ToList());
        }
 public async Task <List <DAL.App.DTO.DomainLikeDTO.ProductWithDefect> > AllAsyncByDefectId(int defectId)
 {
     return(await RepositoryDbSet
            .Where(a => a.DefectId == defectId).Select(e => ProductWithDefectMapper.MapFromDomain(e)).ToListAsync());
 }