Exemplo n.º 1
0
        public async Task AddingDuplicateAirplaneReturnsDuplicateResult()
        {
            // Arrange
            Airplane airplane = new Airplane()
            {
                Name = "F300"
            };

            // Act
            AddResult addResult = await _airplaneService.AddAsync(airplane);

            // Assert
            Assert.AreEqual(ResultTypes.Duplicate, addResult.ResultType);
        }
Exemplo n.º 2
0
        public async Task <ActionResult> AddAirplaneAsync([FromBody] Airplane airplane)
        {
            BlAirplane airplaneBl = _mapper.Map <BlAirplane>(airplane);

            AddResult addAddResult = await _airplaneService.AddAsync(airplaneBl);

            if (addAddResult.ResultType == ResultTypes.Duplicate)
            {
                return(BadRequest());
            }

            return(Ok(new { Id = addAddResult.ItemId }));
        }