Пример #1
0
        //Summary: Delete a movie
        public bool Delete(int movieId)
        {
            var resultMovie = MovieDAL.Delete(movieId);

            if (!resultMovie)
            {
                return(false);
            }

            var movieOrderDAL     = new MovieOrderDAL();
            var movieOrders       = movieOrderDAL.GetAll();
            var orderDeleteResult = true;

            if (movieOrders != null && movieOrders.Count != 0)
            {
                foreach (var order in movieOrders)
                {
                    if (movieId == order.RentedMovieId)
                    {
                        orderDeleteResult = movieOrderDAL.Delete(order.ID);
                    }

                    if (!orderDeleteResult)
                    {
                        return(false);
                    }
                }
            }

            return(resultMovie && orderDeleteResult);
        }
Пример #2
0
        //Summary: Delete a movie
        public bool Delete(int movieId)
        {
            var resultMovie = MovieDAL.Delete(movieId);

            if (!resultMovie)
            {
                return(false);
            }

            return(true);
        }