Esempio n. 1
0
        public void AddCar(Car car, DateTime?timeEnter = null)
        {
            lock (_locker)
            {
                if (car == null)
                {
                    throw new ArgumentNullException("Car cannot be null");
                }

                if (ParkingLot.Cars.Count == AvailableSpaces)
                {
                    throw new ParkingLotFullException();
                }

                if (ParkingLot.Cars.Any(x => x.Number.Equals(car.Number)))
                {
                    throw new NotSupportedException("A car with the same number is already inside");
                }

                var parkingInfo = new ParkingInfo(car.Number, timeEnter);
                ParkingLot.ParkingInfos.Add(parkingInfo);

                ParkingLot.Cars.Add(car);
            }
        }
        public async Task <ActionResult <ParkingInfo> > PostParkingInfo(ParkingInfo parkingInfo)
        {
            _context.ParkingInfos.Add(parkingInfo);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetParkingInfo", new { id = parkingInfo.Id }, parkingInfo));
        }
        public async Task <IActionResult> PutParkingInfo(long id, ParkingInfo parkingInfo)
        {
            if (id != parkingInfo.Id)
            {
                return(BadRequest());
            }

            _context.Entry(parkingInfo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ParkingInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 4
0
 private void FrmParkingDetail_Load(object sender, EventArgs e)
 {
     lblCarNo.Text     = packingInfo.Car_No;
     lblCarStatus.Text = packingInfo.PackingStatusDesc();
     lblPacking.Text   = packingInfo.ParkingName;
     lblCarType.Text   = ParkingInfo.getStowageCarType(packingInfo.STOWAGE_ID);
     ParkingInfo.dgvStowageMessage(packingInfo.STOWAGE_ID, dgvStowageMessage);
     ParkingInfo.dgvStowageOrder(packingInfo.ParkingName, dgvCraneOder);
     ShiftStowageMessage();
     this.Deactivate += new EventHandler(frmSaddleDetail_Deactivate);
 }