예제 #1
0
 public async Task Update(ShipmentCostDto shipmentItem)
 {
     try
     {
         var editItem = _shipmentRepository.Single(e => e.Id == shipmentItem.Id);
         var cityId = Guid.Parse(shipmentItem.City);
         editItem.City = _cityRepository.FirstOrDefault(e => e.Id == cityId);
         editItem.NextKilo = shipmentItem.NextKilo;
         editItem.FirstKilo = shipmentItem.FirstKilo;
         editItem.Expedition = shipmentItem.Expedition;
         editItem.Type = shipmentItem.Type;
         editItem.KiloQuantity = shipmentItem.KiloQuantity;
         await _shipmentRepository.UpdateAsync(editItem);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
        public async Task Create(ShipmentCostDto shipmentItem)
        {
            var id = Guid.Parse(shipmentItem.City);
            var city = _cityRepository.FirstOrDefault(e => e.Id == id);
            var item = new ShipmentCost
            {
                City = city ,
                CreationTime = DateTime.Now,
                CreatorUser = _userRepository.Get(AbpSession.GetUserId()),
                CreatorUserId = AbpSession.GetUserId(),
                Expedition = shipmentItem.Expedition,
                Type = shipmentItem.Type,
                FirstKilo = shipmentItem.FirstKilo,
                NextKilo = shipmentItem.NextKilo,
                KiloQuantity = shipmentItem.KiloQuantity
            };

            await _shipmentRepository.InsertAsync(item);
        }