Esempio n. 1
0
        public ShipmentEntity Create(ShipmentEntity ShipmentEntity)
        {
            Shipment shipment = ShipmentEntity.ToModel();

            smartDeliveryContext.Shipment.Add(shipment);
            smartDeliveryContext.SaveChanges();
            return(new ShipmentEntity(shipment));
        }
Esempio n. 2
0
        public ShipmentEntity Update(Guid ShipmentId, ShipmentEntity ShipmentEntity)
        {
            Shipment shipments = smartDeliveryContext.Shipment.Where(m => m.Id == ShipmentId).FirstOrDefault();

            if (shipments == null)
            {
                throw new BadRequestException("Shipment khong ton tai");
            }
            ShipmentEntity.ToModel(shipments);
            smartDeliveryContext.Shipment.Update(shipments);
            smartDeliveryContext.SaveChanges();
            return(new ShipmentEntity(shipments));
        }
Esempio n. 3
0
 public ShipmentEntity Update(Guid shipmentId, [FromBody] ShipmentEntity shipmentEntity)
 {
     return(shipmentService.Update(shipmentId, shipmentEntity));
 }
Esempio n. 4
0
 public ShipmentEntity Create([FromBody] ShipmentEntity shipmentEntity)
 {
     return(shipmentService.Create(shipmentEntity));
 }