Esempio n. 1
0
        public IActionResult UpdateBus(int id, NewBusModel newBus)
        {
            BusDTO bus = new()
            {
                Capacity      = newBus.Capacity,
                Description   = newBus.Description,
                Operator      = newBus.Operator,
                SeatsBooked   = newBus.SeatsBooked,
                VehicleNumber = newBus.VechileNumber
            };
            OperationResult result = BusBDC.Update(id, bus);

            return(this.GetResponse(result));
        }
Esempio n. 2
0
        public IActionResult New(NewBusModel newBus)
        {
            BusDTO busDTO = new()
            {
                Capacity      = newBus.Capacity,
                Description   = newBus.Description,
                Operator      = newBus.Operator,
                SeatsBooked   = newBus.SeatsBooked,
                VehicleNumber = newBus.VechileNumber,
            };
            OperationResult result   = BusBDC.Add(busDTO);
            IActionResult   response = null;

            if (result.Status == OperationResultStatusType.Success)
            {
                response = CreatedAtAction(nameof(Get), busDTO);
            }
            return(response);
        }