예제 #1
0
        public async Task <IActionResult> CreateFestivalAsync([FromBody] CreateFestivalViewModel createFestivalViewModel)
        {
            var createFestivalDTO = _mapper.Map <CreateFestivalDTO>(createFestivalViewModel);

            var festivalDTO = await _festivalService.CreateFestivalAsync(createFestivalDTO);

            var festivalViewModel = _mapper.Map <FestivalViewModel>(festivalDTO);

            return(Ok(festivalViewModel));
        }
예제 #2
0
        public async Task <IActionResult> CreateFestival([FromBody] CreateFestivalRequest request)
        {
            var festival = new Festival
            {
                Title = request.Title,
                City  = request.City
            };

            await _festivalService.CreateFestivalAsync(festival);

            var response = new BaseResponse <Festival>
            {
                Data    = festival,
                Message = "festival.create.success",
                Code    = "success"
            };

            return(Created("", response));
        }