Exemplo n.º 1
0
        public async Task <ActionResult <PublicApi.v1.DTO.ProductInCategory> > GetProductInCategory(int id)
        {
            var productInCategory = await _bll.ProductsInCategory.GetAsyncByShopAndIdDTO(id, User.GetShopId());

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

            return(ProductInCategoryMapper.MapFromBLL(productInCategory));
        }
 public override async Task<List<ProductInCategory>> AllAsync()
 {
     return await RepositoryDbSet
         .Include(p => p.Category).ThenInclude(a => a.CategoryName).ThenInclude(t => t.Translations)
         .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)
         .Select(e => ProductInCategoryMapper.MapFromDomain(e)).ToListAsync();
 }
Exemplo n.º 3
0
        public async Task <IActionResult> PutProductInCategory(int id, PublicApi.v1.DTO.ProductInCategory productInCategory)
        {
            if (!ModelState.IsValid || id != productInCategory.Id)
            {
                return(BadRequest());
            }

            _bll.ProductsInCategory.Update(ProductInCategoryMapper.MapFromExternal(productInCategory));
            await _bll.SaveChangesAsync();

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

            return ProductInCategoryMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == productInCategory.Id)
                .Include(p => p.Category).ThenInclude(a => a.CategoryName).ThenInclude(t => t.Translations)
                .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)
                .FirstOrDefaultAsync());
        }
Exemplo n.º 5
0
        public async Task <ActionResult <IEnumerable <PublicApi.v1.DTO.ProductInCategory> > > GetProductsInCategory()
        {
            var productInCategory = (await _bll.ProductsInCategory.AllAsyncByShopDTO(User.GetShopId())).Select(e => ProductInCategoryMapper.MapFromBLL(e)).ToList();

            return(productInCategory);
        }
 public async Task<List<ProductInCategory>> AllAsyncByCategoryId(int categoryId)
 {
     return await RepositoryDbSet
         .Where(a => a.CategoryId == categoryId).Select(e => ProductInCategoryMapper.MapFromDomain(e)).ToListAsync();
 }
 public async Task <List <ProductIdName> > AllAsyncByCategoryIdAndShopId(int categoryId, int?shopId)
 {
     return((await Uow.ProductsInCategory.AllAsyncByCategoryIdAndShopId(categoryId, shopId))
            .Select(e => ProductInCategoryMapper.MapFromDAL(e)).ToList());
 }
 public async Task <DTO.ProductInCategory> GetAsyncByShopAndIdDTO(int id, int?shopId)
 {
     return(ProductInCategoryMapper.MapFromDAL(await Uow.ProductsInCategory.GetAsyncByShopAndIdDTO(id, shopId)));
 }
 public async Task <List <DTO.ProductInCategory> > AllAsyncByShopDTO(int?shopId)
 {
     return((await Uow.ProductsInCategory.AllAsyncByShopDTO(shopId)).Select(e => ProductInCategoryMapper.MapFromDAL(e)).ToList());
 }
Exemplo n.º 10
0
 public override async Task <ProductInCategory> FindAsync(params object[] id)
 {
     return(ProductInCategoryMapper.MapFromDAL(await Uow.ProductsInCategory.FindAsync(id)));
 }
Exemplo n.º 11
0
        /*public override async Task<IEnumerable<ProductInCategory>> AllAsync()
         * {
         *  return await UOW.ProductInCategory.AllAsync();
         * }
         *
         * public override async Task<ProductInCategory> FindAsync(params object[] id)
         * {
         *  return await UOW.ProductInCategory.FindAsync(id);
         * }
         *
         * public async Task<IEnumerable<ProductInCategory>> AllAsyncByShop(int? shopId)
         * {
         *  return await UOW.ProductInCategory.AllAsyncByShop(shopId);
         * }
         *
         * public async Task<IEnumerable<ProductInCategoryDTO>> AllAsyncByShopDTO(int? shopId)
         * {
         *  return await UOW.ProductInCategory.AllAsyncByShopDTO(shopId);
         * }
         *
         * public async Task<ProductInCategoryDTO> GetAsyncByShopAndIdDTO(int id, int? shopId)
         * {
         *  return await UOW.ProductInCategory.GetAsyncByShopAndIdDTO(id, shopId);
         * }*/

        public override async Task <List <ProductInCategory> > AllAsync()
        {
            return((await Uow.ProductsInCategory.AllAsync()).Select(e => ProductInCategoryMapper.MapFromDAL(e)).ToList());
        }