コード例 #1
0
        public async Task AddToStoreBranch(int itemId, params int[] storeBranchIds)
        {
            _ = await Repository.FindAsync(itemId) ?? throw new EntityNotFoundException();

            foreach (var id in storeBranchIds)
            {
                var storeBranchE = await StoreBranchRepository.GetAsync(id)
                                   ?? throw new EntityNotFoundException("One of the specified store branches does not exist");

                await ItemStoreBranchRepository.InsertAsync(new ItemStoreBranchEntity(itemId, storeBranchE.Id));
            }
        }
コード例 #2
0
        public async Task <IList <StoreBranchEntity> > GetStoreBranches(IList <CityEntity> cityEntities)
        {
            var storeBranchesList = new List <StoreBranchEntity>();

            foreach (var cityE in cityEntities)
            {
                var branchEsList = await AsyncExecutor.ToListAsync(StoreBranchRepository.Where(e => e.CityID == cityE.Id));

                storeBranchesList.AddRange(branchEsList);
            }

            return(storeBranchesList);
        }
コード例 #3
0
        public async Task <StoreBranchDto[]> GetBranchesWithinRadius(int cityId)
        {
            var sbEs = await StoreBranchRepository.GetAllBranchAroundTheCityAsync(cityId);

            return(ObjectMapper.Map <StoreBranchEntity[], StoreBranchDto[]>(sbEs));
        }