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))); }
public async Task <IActionResult> New( [FromForm] CinemaDto cinema) { if (ModelState.IsValid) { await cinemaService.CreateAsync(cinema); return(RedirectToAction("Cinemas")); } return(Redirect("OasisWebApp/Home")); }
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)); } }