示例#1
0
        public IHttpActionResult GetMovieShowings(MovieNameDTO movie) // GETS MOVIESHOWINGS
        {
            MoviesManager mmgr    = new MoviesManager();
            int           movieId = mmgr.GetMovieIdFromName(movie.MovieName);

            if (movieId == 0)
            {
                TextResult failedToFindMovieShowing = new TextResult("Movieshowing does not exist!", msg);
                return(failedToFindMovieShowing);
            }
            var movieList = mmgr.GetMovieShowingsFromMovieId(movieId); // Gets movieshowingtimes and puts in list

            return(Ok(movieList));
        }
示例#2
0
        public IHttpActionResult DeleteMovieShowings(MovieNameDTO movie)
        {
            TextResult    httpResponse = new TextResult("Could not delete movieshowing!", msg);
            MoviesManager mmgr         = new MoviesManager();
            int           movieId      = mmgr.GetMovieIdFromName(movie.MovieName);

            if (movieId == 0)
            {
                return(NotFound());
            }
            try
            {
                db.MovieShowings.RemoveRange(db.MovieShowings.Where(x => x.movieId == movieId));
                db.SaveChanges();
            } catch
            {
                return(httpResponse);
            }


            return(Ok());
        }