public IActionResult RunChampionship([FromBody] IEnumerable <Movie> movies)
 {
     try
     {
         var result = _championshipService.RunChampionship(movies);
         return(result.ToHttpResponse());
     }
     catch (Exception)
     {
         return(new Result("Erro ao execultar campeonato, tente novamente mais tarde", HttpStatusCode.InternalServerError).ToHttpResponse());
     }
 }
Example #2
0
        public ActionResult <IRound> Post([FromBody] List <MovieViewModel> movies)
        {
            var championshipResult = _championshipService.RunChampionship(movies.Select(x => new Movie()
            {
                Ano    = x.ano,
                Id     = x.id,
                Nota   = x.nota,
                Titulo = x.titulo
            }).ToList <IMovie>());

            var finalMatch = championshipResult.Matches.First();

            return(Ok(new List <MoviePodiumViewModel>()
            {
                new MoviePodiumViewModel(1, finalMatch.Winner.Titulo),
                new MoviePodiumViewModel(2, finalMatch.Loser.Titulo),
            }));
        }