public async Task <IActionResult> AddMovie(int userId, [FromBody] MovieRankRequest movieRankRequest) { await _movieRankService.AddMovie(userId, movieRankRequest); return(Ok()); }
public async Task <IActionResult> AddMovie(int userId, [FromBody] MovieRankRequest movieRankRequest) { try { await movieRankService.AddMovie(userId, movieRankRequest); } catch (System.Exception ex) { throw ex; } return(Ok()); }
public void Run(bool seed) { if (seed) { var data = System.IO.File.ReadAllText("Data/UserSeedData.json"); var movies = JsonConvert.DeserializeObject <List <Movie> >(data); //create user in the table foreach (var movie in movies) { _rankService.AddMovie(movie.UserId, new MovieRankRequest() { MovieName = movie.MovieName, Actors = movie.Actors, Description = movie.Description, Ranking = movie.Ranking, }, CancellationToken.None).RunSynchronously(); } } }
public async Task <IActionResult> AddMovie([FromRoute] int userId, [FromBody] MovieRankRequest movieRankRequest) { await _movieRankService.AddMovie(userId, movieRankRequest, CancellationToken.None); return(Ok()); }