public async Task <ActionResult> CreateFestival([FromBody] FestivalCreateRequestBody createRequestBody)
        {
            var validationResult = await _createValidator.ValidateAsync(createRequestBody);

            if (!validationResult.IsValid)
            {
                return(BadRequest(validationResult.Errors));
            }

            var mappedValue = _mapper.Map <Festival>(createRequestBody);
            await _service.AddFestival(mappedValue);

            return(Ok(mappedValue));
        }
示例#2
0
        public async Task When_Add_Festival_To_Repository_Should_Return_It_Back()
        {
            //Arrange
            const int id       = 100;
            var       festival = new Festival
            {
                Name        = "Test",
                Description = "TestDescription",
                Id          = id
            };

            //Act
            var result = await _service.AddFestival(festival);

            //Assert
            Assert.AreEqual(festival.Id, result.Id);
        }