Пример #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());
        }
Пример #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));
        }
Пример #4
0
 public override void Update(ShipmentEntity shipmentEntity)
 {
     shipmentEntity.UpdatedDate = DateTime.Now;
     _shipmentRepository.Update(shipmentEntity);
 }
Пример #5
0
 public Shipment Update(Shipment ShipmentUpdate)
 {
     return(ShipmentRepo.Update(ShipmentUpdate));
 }