public async Task <IActionResult> AddMovie(int userId,
                                                   [FromBody] MovieRankRequest movieRankRequest)
        {
            await _movieRankService.AddMovie(userId, movieRankRequest);

            return(Ok());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> AddMovie(int userId, [FromBody] MovieRankRequest movieRankRequest)
        {
            try
            {
                await movieRankService.AddMovie(userId, movieRankRequest);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }

            return(Ok());
        }
Exemplo n.º 3
0
        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();
                }
            }
        }
Exemplo n.º 4
0
        public async Task <IActionResult> AddMovie([FromRoute] int userId, [FromBody] MovieRankRequest movieRankRequest)
        {
            await _movieRankService.AddMovie(userId, movieRankRequest, CancellationToken.None);

            return(Ok());
        }