public ActionResult<Movie> GetMovieByName([FromQuery] string name)
 {
     var movie = StaticDb.GetAllMovies().SingleOrDefault(m => m.Name.ToLower() == name.ToLower());
     if (movie == null)
     {
         return BadRequest("No such movie exists");
     }
     return Ok(movie);
 }
 public ActionResult<Movie> GetById([FromRoute] int id)
 {
     var movie = StaticDb.GetAllMovies().SingleOrDefault(m => m.Id == id);
     if (movie == null)
     {
         return BadRequest("No movie with that id found");
     }
     return Ok(movie);
 }
 public ActionResult Post([FromBody] Movie movie)
 {
     var movieCheck = StaticDb.GetAllMovies().SingleOrDefault(m => m.Id == movie.Id);
     if (movieCheck != null)
     {
         return StatusCode(StatusCodes.Status500InternalServerError, "Movie with that id already exists");
     }
     movie.Id = StaticDb.GetAllMovies().Count + 1;
     StaticDb.GetAllMovies().Add(movie);
     return Ok("Movie added successfully");
 }
 public ActionResult<List<string>> GetArtistsFromMovie([FromRoute] int id, [FromQuery] string name)
 {
     var movie = StaticDb.GetAllMovies().SingleOrDefault(m => m.Id == id);
     if (movie == null)
     {
         return BadRequest("No such movie exists");
     }
     var artistsContainingName = new List<string>();
     foreach (var artistName in movie.Artists)
     {
         if (artistName.ToLower().StartsWith(name.ToLower()))
         {
             artistsContainingName.Add(artistName);
         }
     }
     if (artistsContainingName.Count < 1)
     {
         return StatusCode(StatusCodes.Status404NotFound, "No artists that contain that name were found");
     }
     return Ok(artistsContainingName);
 }
        static async Task Main(string[] args)
        {
            SpeechProcessor.Logging = true;
            CommandHandler.Logging  = true;
            while (true)
            {
                //StaticDb.CreateContext();
                try
                {
                    //var runner = new Runner();
                    //await runner.Run();
                    await commandHandler.HandleVoiceCommand();
                }
                catch (CancelIntentException)
                { }
                catch (BotException ex)
                {
                    Console.WriteLine(ex.Message);
                    if (!string.IsNullOrEmpty(ex.Message))
                    {
                        await speechProcessor.TextToSpeech(ex.Message);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error! " + ex.Message);
                }

                Console.WriteLine();
                Console.WriteLine(StaticDb.ListDevices());
                Console.WriteLine();
                Console.WriteLine("***Press Enter and say next command or type \"exit\" to close aplication.***");
                var input = Console.ReadLine();
                if (input.ToLower() == "exit")
                {
                    break;
                }
            }
        }
 public CommandHandler()
 {
     LUProcessor     = new LUProcessor();
     SpeechProcessor = new SpeechProcessor();
     DbContext       = StaticDb.CreateContext();
 }
 public ActionResult<List<Movie>> GetAllMovies()
 {
     return Ok(StaticDb.GetAllMovies());
 }