예제 #1
0
        private LogisticsListDto PrepareLogisticsListDto(Logistics logistics)
        {
            var dto = ObjectMapper.Map <LogisticsListDto>(logistics);

            dto.Prefix = CommonHelper.ChangeByName(dto.Name.Substring(0, 1));

            if (dto.Prefix.IsNullOrWhiteSpace())
            {
                dto.Prefix = logistics.Memo?.Substring(0, 1) ?? string.Empty;
            }

            return(dto);
        }
예제 #2
0
        public async Task <EntityDto <long> > CreateOrUpdateLogistics(CreateOrUpdateLogisticsInput input)
        {
            Logistics logistics = null;

            if (input.Id.HasValue && input.Id.Value > 0)
            {
                logistics = await UpdateLogisticsAsync(input);
            }
            else
            {
                logistics = await CreateLogisticsAsync(input);
            }

            await CurrentUnitOfWork.SaveChangesAsync();

            return(new EntityDto <long> {
                Id = logistics.Id
            });
        }
예제 #3
0
 /// <summary>
 /// 更新物流
 /// </summary>
 /// <param name="logistics"></param>
 public virtual async Task UpdateAsync(Logistics logistics)
 {
     await LogisticsRepository.UpdateAsync(logistics);
 }
예제 #4
0
 /// <summary>
 /// 删除物流
 /// </summary>
 /// <param name="logistics"></param>
 public virtual async Task DeleteAsync(Logistics logistics)
 {
     await LogisticsRepository.DeleteAsync(logistics);
 }
예제 #5
0
 /// <summary>
 /// 添加物流
 /// </summary>
 /// <param name="logistics"></param>
 public virtual async Task CreateAsync(Logistics logistics)
 {
     await LogisticsRepository.InsertAsync(logistics);
 }