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(); }
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()); }
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()); }
public override async Task <ProductInCategory> FindAsync(params object[] id) { return(ProductInCategoryMapper.MapFromDAL(await Uow.ProductsInCategory.FindAsync(id))); }
/*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()); }