public async Task <IActionResult> CreateAsync(CreateCinemaRequest request, CancellationToken token)
        {
            _logger.LogInformation("POST /cinema request accepted");
            var response = await _cinemaService.CreateAsync(_mapper.Map <CinemaDTO>(request));

            return(Ok(_mapper.Map <CinemaResponse>(response)));
        }
예제 #2
0
        public async Task <IActionResult> New(
            [FromForm] CinemaDto cinema)
        {
            if (ModelState.IsValid)
            {
                await cinemaService.CreateAsync(cinema);

                return(RedirectToAction("Cinemas"));
            }
            return(Redirect("OasisWebApp/Home"));
        }
예제 #3
0
        public async Task <IActionResult> Create(CinemaCreateViewModel dto)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(dto));
                }

                var cinema = mapper.Map <Cinema>(dto);
                await cinemaService.CreateAsync(cinema);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View(dto));
            }
        }