예제 #1
0
        public Result FilterMovies(int MovieGenreID, int ResetInd)
        {
            Result sr = new Result();

            try
            {
                if (ResetInd == 0)
                {
                    MELib.Movies.MovieList MovieList = MELib.Movies.MovieList.GetMovieList(MovieGenreID);
                    sr.Data = MovieList;
                }
                else
                {
                    MELib.Movies.MovieList MovieList = MELib.Movies.MovieList.GetMovieList();
                    sr.Data = MovieList;
                }
                sr.Success = true;
            }
            catch (Exception e)
            {
                WebError.LogError(e, "Page: LatestReleases.aspx | Method: FilterMovies", $"(int MovieGenreID, ({MovieGenreID})");
                sr.Data      = e.InnerException;
                sr.ErrorText = "Could not filter movies by category.";
                sr.Success   = false;
            }
            return(sr);
        }
예제 #2
0
    public static Result DeleteMovie(int MovieID)
    {
      Result sr = new Result();
      try
      {
        //MELib.Movies.Movie MovieToRemove = MELib.Movies.MovieList.GetMovieList().FirstOrDefault(c => c.MovieID == MovieID);
        //MovieToRemove.IsActiveInd = false;
        //MovieToRemove.TrySave();
        // We cannot save object directly need to add it to a list...


        MELib.Movies.MovieList MovieList = MELib.Movies.MovieList.GetMovieList(MovieID);
        MovieList.ToList().ForEach(c => { c.IsActiveInd = false; });
        MovieList.TrySave();

     //   MovieToRemove.IsActiveInd = false;
     // MovieToRemove.TrySave();


        sr.Success = true;
      }
      catch (Exception e)
      {
        sr.Data = e.InnerException;
        sr.Success = false;
      }
      return sr;
    }
        public Result SaveMovieList(MELib.Movies.MovieList MovieList)
        {
            Result sr = new Result();

            if (MovieList.IsValid)
            {
                var SaveResult = MovieList.TrySave();
                if (SaveResult.Success)
                {
                    sr.Data    = SaveResult.SavedObject;
                    sr.Success = true;
                }
                else
                {
                    sr.ErrorText = SaveResult.ErrorText;
                    sr.Success   = false;
                }
                return(sr);
            }
            else
            {
                sr.ErrorText = MovieList.GetErrorsAsHTMLString();
                return(sr);
            }
        }
예제 #4
0
 protected override void Setup()
 {
     base.Setup();
     MovieList = MELib.Movies.MovieList.GetMovieList();
 }