예제 #1
0
        public ShipmentGoodEntity Create(ShipmentGoodEntity ShipmentGoodEntity)
        {
            ShipmentGoods shipmentGood = ShipmentGoodEntity.ToModel();

            smartDeliveryContext.ShipmentGoods.Add(shipmentGood);
            smartDeliveryContext.SaveChanges();
            return(new ShipmentGoodEntity(shipmentGood));
        }
예제 #2
0
        public ShipmentGoodEntity Update(Guid ShipmentGoodId, ShipmentGoodEntity ShipmentGoodEntity)
        {
            ShipmentGoods shipmentGood = smartDeliveryContext.ShipmentGoods.Where(m => m.Id == ShipmentGoodId)
                                         .Include(u => u.Goods)
                                         .Include(u => u.Shipment)
                                         .FirstOrDefault();

            if (shipmentGood == null)
            {
                throw new BadRequestException("ShipmentGood khong ton tai");
            }
            ShipmentGoodEntity.ToModel(shipmentGood);
            smartDeliveryContext.ShipmentGoods.Update(shipmentGood);
            smartDeliveryContext.SaveChanges();
            return(new ShipmentGoodEntity(shipmentGood));
        }
 public ShipmentGoodEntity Update(Guid shipmentGoodId, [FromBody] ShipmentGoodEntity shipmentEntity)
 {
     return(shipmentGoodService.Update(shipmentGoodId, shipmentEntity));
 }
 public ShipmentGoodEntity Create([FromBody] ShipmentGoodEntity shipmentEntity)
 {
     return(shipmentGoodService.Create(shipmentEntity));
 }