public async Task AddingFlightSeatTypeCostReturnsOkResult()
        {
            // Arrange
            FlightSeatTypeCost seatTypeCost = new FlightSeatTypeCost()
            {
                SeatTypeId = 1,
                FlightId   = 1,
                Cost       = 300
            };

            // Act
            ResultTypes addResult = await _flightService.AddFlightSeatTypeCostAsync(seatTypeCost);

            // Assert
            Assert.AreEqual(ResultTypes.Ok, addResult);
        }
Example #2
0
        public async Task <IActionResult> AddFlightSeatTypeCostAsync(
            int flightId,
            [FromBody] FlightSeatTypeCost seatTypeCost
            )
        {
            BlFlightSeatTypeCost seatTypeCostBl = _mapper.Map <BlFlightSeatTypeCost>(seatTypeCost);

            seatTypeCostBl.FlightId = flightId;

            ResultTypes addResult = await _flightService.AddFlightSeatTypeCostAsync(seatTypeCostBl);

            switch (addResult)
            {
            case ResultTypes.NotFound:
                return(NotFound());

            case ResultTypes.Duplicate:
                return(BadRequest());
            }

            return(Ok());
        }