Exemple #1
0
        public async Task <List <Return> > AllAsyncByShop(int?shopId, string order, string searchFor, int?pageIndex, int?pageSize)
        {
            var query = RepositoryDbSet
                        .Include(a => a.Description).ThenInclude(t => t.Translations)
                        .Include(a => a.Shop).ThenInclude(aa => aa.ShopName).ThenInclude(t => t.Translations)
                        .Include(a => a.Shop).ThenInclude(aa => aa.ShopAddress).ThenInclude(t => t.Translations)
                        .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact).ThenInclude(t => t.Translations)
                        .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact2).ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName)
                        .ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length)
                        .ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight)
                        .ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode)
                        .ThenInclude(t => t.Translations)
                        .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode)
                        .ThenInclude(t => t.Translations)
                        .Where(p => p.ShopId == shopId)
                        .AsQueryable();

            query = Search(query, searchFor);
            query = Order(query, order);
            if (pageIndex != null && pageSize != null)
            {
                query = query.Skip((pageIndex.Value - 1) * pageSize.Value).Take(pageSize.Value);
            }
            var temp = await query.ToListAsync();

            var res = temp.Select(e => ReturnMapper.MapFromDomain(e)).ToList();

            return(res);
        }
        public async Task <ActionResult <PublicApi.v1.DTO.Return> > GetReturn(int id)
        {
            var @return = await _bll.Returns.FindWithProductsReturnedByIdAndShopAsync(id, User.GetShopId());

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

            return(ReturnMapper.MapFromBLL(@return));
        }
        public async Task <IActionResult> PutReturn(int id, PublicApi.v1.DTO.Return @return)
        {
            if (!ModelState.IsValid || id != @return.Id || @return.ShopId != User.GetShopId())
            {
                return(BadRequest());
            }

            _bll.Returns.Update(ReturnMapper.MapFromExternal(@return));
            await _bll.SaveChangesAsync();

            return(NoContent());
        }
Exemple #4
0
 public override async Task <List <Return> > AllAsync()
 {
     return(await RepositoryDbSet
            .Include(a => a.Description).ThenInclude(t => t.Translations)
            .Include(a => a.Shop).ThenInclude(aa => aa.ShopName).ThenInclude(t => t.Translations)
            .Include(a => a.Shop).ThenInclude(aa => aa.ShopAddress).ThenInclude(t => t.Translations)
            .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact).ThenInclude(t => t.Translations)
            .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact2).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations)
            .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations)
            .Select(e => ReturnMapper.MapFromDomain(e)).ToListAsync());
 }
Exemple #5
0
        public override async Task <Return> FindAsync(params object[] id)
        {
            var @return = await RepositoryDbSet.FindAsync(id);

            return(ReturnMapper.MapFromDomain(await RepositoryDbSet.Where(a => a.Id == @return.Id)
                                              .Include(a => a.Description).ThenInclude(t => t.Translations)
                                              .Include(a => a.Shop).ThenInclude(aa => aa.ShopName).ThenInclude(t => t.Translations)
                                              .Include(a => a.Shop).ThenInclude(aa => aa.ShopAddress).ThenInclude(t => t.Translations)
                                              .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact).ThenInclude(t => t.Translations)
                                              .Include(a => a.Shop).ThenInclude(aa => aa.ShopContact2).ThenInclude(t => t.Translations)
                                              .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations)
                                              .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Length).ThenInclude(t => t.Translations)
                                              .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.Weight).ThenInclude(t => t.Translations)
                                              .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ManuFacturerItemCode).ThenInclude(t => t.Translations)
                                              .Include(a => a.ProductsReturned).ThenInclude(a => a.Product).ThenInclude(aa => aa.ShopCode).ThenInclude(t => t.Translations)
                                              .FirstOrDefaultAsync()));
        }
        public async Task <ActionResult <IEnumerable <PublicApi.v1.DTO.IdAndNameDTO.ReturnIdName> > > GetReturnIdName()
        {
            var @return = (await _bll.Returns.GetAllIdAndDescAsyncByShopDTO(User.GetShopId())).Select(e => ReturnMapper.MapFromBLL(e)).ToList();

            return(@return);
        }
        public async Task <ActionResult <IEnumerable <PublicApi.v1.DTO.Return> > > GetReturns(string search, int?pageIndex, int?pageSize)
        {
            if ((pageIndex != null && pageIndex < 1) || (pageSize != null && pageSize < 1))
            {
                return(BadRequest());
            }
            var @return = (await _bll.Returns.GetAllWithProductsReturnedByShopAsync(User.GetShopId(), search, pageIndex, pageSize)).Select(e => ReturnMapper.MapFromBLL(e)).ToList();

            return(@return);
        }
Exemple #8
0
        public async Task <List <Return> > AllAsync(string order, string searchFor, int?pageIndex, int?pageSize)
        {
            var res = (await Uow.Returns.AllAsync(order, searchFor, pageIndex, pageSize)).Select(e => ReturnMapper.MapFromDAL(e)).ToList();

            return(SearchSort(res, order, searchFor));
        }
Exemple #9
0
 public async Task <List <BLL.App.DTO.IdAndNameDTO.ReturnIdName> > GetAllIdAndDescAsyncByShopDTO(int?shopId)
 {
     return((await Uow.Returns.GetAllIdAndDescAsyncByShopDTO(shopId)).Select(e => ReturnMapper.MapFromDAL(e)).ToList());
 }
Exemple #10
0
 public async Task <ReturnWithProductCount> FindWithProductsReturnedByIdAndShopAsync(int id, int?shopId)
 {
     return(ReturnMapper.MapFromDAL(await Uow.Returns.FindWithProductsReturnedByIdAndShopAsync(id, shopId)));
 }
Exemple #11
0
 public async Task <List <ReturnWithProductCount> > GetAllWithProductsReturnedByShopAsync(int?shopId, string search, int?pageIndex, int?pageSize)
 {
     return((await Uow.Returns.GetAllWithProductsReturnedByShopAsync(shopId, search, pageIndex, pageSize)).Select(e => ReturnMapper.MapFromDAL(e)).ToList());
 }
Exemple #12
0
 public override async Task <Return> FindAsync(params object[] id)
 {
     return(ReturnMapper.MapFromDAL(await Uow.Returns.FindAsync(id)));
 }
Exemple #13
0
 public override async Task <List <Return> > AllAsync()
 {
     return((await Uow.Returns.AllAsync()).Select(e => ReturnMapper.MapFromDAL(e)).ToList());
 }