コード例 #1
0
        public async Task AddEntity_When_ValidAirplaneTypeDto_Then_Return_AirplaneTypeDto()
        {
            var validAirplaneTypeDto = new AirplaneTypeDto()
            {
                Model         = "Airbus A310",
                NumberOfSeats = 183,
                LoadCapacity  = 164000
            };

            var result = await _service.AddEntityAsync(validAirplaneTypeDto);

            Assert.AreEqual(validAirplaneTypeDto.NumberOfSeats, result.NumberOfSeats);
        }
コード例 #2
0
        public async Task <IActionResult> Post([FromBody] AirplaneTypeDto airplaneTypeDto)
        {
            try
            {
                var airplaneTypeToReturn = await _airplaneTypeService.AddEntityAsync(airplaneTypeDto);

                return(CreatedAtRoute("GetAirplaneType", new { id = airplaneTypeToReturn.Id }, airplaneTypeToReturn));
            }
            catch (BadRequestException)
            {
                return(BadRequest());
            }
        }
コード例 #3
0
        public async Task <IActionResult> Post([FromBody] StewardessDto stewardessDto)
        {
            try
            {
                var stewardessToReturn = await _stewardessService.AddEntityAsync(stewardessDto);

                return(CreatedAtRoute("GetStewardess", new { id = stewardessToReturn.Id }, stewardessToReturn));
            }
            catch (BadRequestException)
            {
                return(BadRequest());
            }
        }
コード例 #4
0
        public async Task <IActionResult> Post([FromBody] DepartureDto departureDto)
        {
            try
            {
                var departureToReturn = await _departureService.AddEntityAsync(departureDto);

                return(CreatedAtRoute("GetDeparture", new { id = departureToReturn.Id }, departureToReturn));
            }
            catch (BadRequestException)
            {
                return(BadRequest());
            }
        }
コード例 #5
0
        public async Task <IActionResult> Post([FromBody] CrewDto crewDto)
        {
            try
            {
                var crewToReturn = await _crewService.AddEntityAsync(crewDto);

                return(CreatedAtRoute("GetCrew", new { id = crewToReturn.Id }, crewToReturn));
            }
            catch (BadRequestException)
            {
                return(BadRequest());
            }
        }
コード例 #6
0
        public async Task <IActionResult> Post([FromBody] PilotDto pilotDto)
        {
            try
            {
                var pilotToReturn = await _pilotService.AddEntityAsync(pilotDto);

                return(CreatedAtRoute("GetPilot", new { id = pilotToReturn.Id }, pilotToReturn));
            }
            catch (BadRequestException)
            {
                return(BadRequest());
            }
        }
コード例 #7
0
        public async Task <IActionResult> Index(OrderDetailViewModel model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                // todo fix dropdown
                model.SelectedCarType = 1;

                var orderDetailDto = _mapper.Map <OrderDetailViewModel, OrderDetailDto>(model);
                await _orderDetailService.AddEntityAsync(orderDetailDto);

                return(RedirectToAction("ThanksView"));
            }

            var orderDetail = await _orderDetailViewModelService.CreateOrderDetail();

            return(View(orderDetail));
        }