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

            smartDeliveryContext.Shipment.Add(shipment);
            smartDeliveryContext.SaveChanges();
            return(new ShipmentEntity(shipment));
        }
Exemplo 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));
        }
Exemplo n.º 3
0
 public ShipmentEntity Update(Guid shipmentId, [FromBody] ShipmentEntity shipmentEntity)
 {
     return(shipmentService.Update(shipmentId, shipmentEntity));
 }
Exemplo n.º 4
0
 public ShipmentEntity Create([FromBody] ShipmentEntity shipmentEntity)
 {
     return(shipmentService.Create(shipmentEntity));
 }