Ejemplo n.º 1
0
        public async Task <Shipment> FinalizeShipment(string id)
        {
            var shipment = await _shipmentRepository.GetShipmentById(id);

            shipment.isFinalized = true;

            return(await _shipmentRepository.Update(shipment));
        }
        public IActionResult Update(int id, [FromBody] JsonPatchDocument <Shipment> shipmentPatch)
        {
            Shipment shipment = _shipmentRepository.GetOne(id);

            if (shipment == null)
            {
                NotFound();
            }

            shipmentPatch.ApplyTo(shipment);

            _shipmentRepository.Update(shipment);
            return(Ok());
        }
Ejemplo n.º 3
0
        public IHttpActionResult PutShipment(int id, ShipmentsModel shipment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != shipment.ShipmentId)
            {
                return(BadRequest());
            }

            Shipment dbShipment = _shipmentRepository.GetById(id);

            dbShipment.Update(shipment);

            _shipmentRepository.Update(dbShipment);

            try
            {
                _unitOfWork.Commit();
            }
            catch (Exception)
            {
                if (!ShipmentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 4
0
 public override void Update(ShipmentEntity shipmentEntity)
 {
     shipmentEntity.UpdatedDate = DateTime.Now;
     _shipmentRepository.Update(shipmentEntity);
 }
Ejemplo n.º 5
0
 public Shipment Update(Shipment ShipmentUpdate)
 {
     return(ShipmentRepo.Update(ShipmentUpdate));
 }