예제 #1
0
        public async Task <ResultEntity> AddOrUpdateAsync(Box box)
        {
            var result = new ResultEntity();
            var exist  = await _boxRepository.GetQueryable().Where(a => a.FrontBn == box.FrontBn && a.PlaceId == box.PlaceId && a.Id != box.Id).CountAsync() > 0;

            if (exist)
            {
                result.Message = "同一交换场所下BN号码不允许重复";
            }
            else
            {
                if (box.Id > 0)
                {
                    _boxRepository.Update(box);
                }
                else
                {
                    await _boxRepository.AddAsync(box);
                }

                result.Success = true;
            }

            return(result);
        }
예제 #2
0
        public async Task <BoxEditDto> GetBoxByPlaceBn(string bn, int placeId)
        {
            var box = await _boxRepository.GetQueryable().FirstOrDefaultAsync(a => a.FrontBn == bn && a.PlaceId == placeId);

            return(Mapper.Map <BoxEditDto>(box));
        }
예제 #3
0
        public async Task <IList <Box> > GetAllBoxs(int placeId)
        {
            var boxs = await _boxRepository.GetQueryable().Where(a => a.PlaceId == placeId).ToListAsync();

            return(boxs);
        }