public async Task <IActionResult> Add(Movie movie) { if (ModelState.IsValid) { await _movieService.AddAsync(movie); } return(RedirectToAction("Index", new{ cinemaId = movie.CinemaId })); }
public async Task <IActionResult> Post([FromBody] MovieRequest movie) { if (!ModelState.IsValid) { return(BadRequest()); } await _movieService.AddAsync(movie); return(Ok()); }
public async Task <IActionResult> Create([Bind("Id,Title,ReleaseDate,Genre,Price")] MovieViewModel movie) { if (ModelState.IsValid) { await _movieService.AddAsync(Mapper.Map(movie)).ConfigureAwait(false); return(RedirectToAction(nameof(Index))); } return(View(movie)); }
public async Task HandleAsync(CreateMovie command) { Console.WriteLine($"Creating movie {command.Title}"); try { await movieService.AddAsync(command.Url, command.Title, command.Duration, command.Description); } catch (Exception ex) { throw ex; } await busClient.PublishAsync(new MovieCreated(command.Id, command.Title)); }
public async Task <IActionResult> Create(Movie movie) { try { var viewmodel = await _movieService.AddAsync(movie); // TODO: Add insert logic here return(RedirectToAction(nameof(Index))); } catch { return(View(movie)); } }
public async Task <IActionResult> Create([Bind("MovieId,Title,Revenue,PosterUrl,VideoUrl,VideoPosterUrl,Summary,ReleaseDate,ContentRatingId")] Movie movie) { if (ModelState.IsValid) { await movieService_.AddAsync(movie); return(RedirectToAction(nameof(Index))); } var contentRatings = await movieService_.GetContentRatingsAsync(); ViewData["ContentRatingId"] = new SelectList(contentRatings, "ContentRatingId", "ShortDescription", movie.ContentRatingId); return(View(movie)); }
public async Task <IActionResult> Post([FromBody] Movie command) { try { if (command == null) { return(NotFound()); } var result = await _movieService.AddAsync(command); return(Ok(result)); } catch (System.Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Request Error")); } }
public async Task <ActionResult> Post([FromBody] AddMovieDto movie) { var id = await _movieService.AddAsync(movie); return(CreatedAtAction("Get", new { Id = id })); }
public async Task <string> Create([FromBody] Movie movie) { await _service.AddAsync(movie); return("Movie created successfully"); }