public IHttpActionResult addMovie(dynamic m)
        {
            Movies movie = new Movies();

            movie.AgeRestrictionID  = m.movie.AgeRestrictionID;
            movie.GenreID           = m.movie.GenreID;
            movie.Name              = m.movie.Name;
            movie.OriginalName      = m.movie.OriginalName;
            movie.ReleaseYear       = m.movie.ReleaseYear;
            movie.PictureBytes      = m.movie.PictureBytes;
            movie.Synopsis          = m.movie.Synopsis;
            movie.DurationInMinutes = m.movie.DurationInMinutes;
            movie.Trailer           = m.movie.Trailer;
            movie.ImageThumb        = m.movie.ImageThumb;
            movie.IsCurrent         = m.movie.IsCurrent;
            movie.IsDeleted         = false;
            movie.MovieDirectorID   = m.movie.MovieDirectorID;

            context.Movies.Add(movie);
            context.SaveChanges();



            foreach (int id in m.movieActor)
            {
                MovieRoles mr = new MovieRoles();
                mr.MovieID = movie.MovieID;
                mr.ActorID = id;

                context.MovieRoles.Add(mr);
                context.SaveChanges();
            }

            return(Ok(new { MovieId = movie.MovieID }));
        }
示例#2
0
 public override bool Equals(object obj)
 {
     return(obj is DiscordSettings settings &&
            BotToken == settings.BotToken &&
            ClientID == settings.ClientID &&
            StatusMessage == settings.StatusMessage &&
            MonitoredChannels.SequenceEqual(settings.MonitoredChannels) &&
            TvShowRoles.SequenceEqual(settings.TvShowRoles) &&
            MovieRoles.SequenceEqual(settings.MovieRoles) &&
            MovieDownloadClient == settings.MovieDownloadClient &&
            MovieDownloadClientConfigurationHash == settings.MovieDownloadClientConfigurationHash &&
            TvShowDownloadClient == settings.TvShowDownloadClient &&
            TvShowDownloadClientConfigurationHash == settings.TvShowDownloadClientConfigurationHash &&
            EnableRequestsThroughDirectMessages == settings.EnableRequestsThroughDirectMessages &&
            AutomaticallyNotifyRequesters == settings.AutomaticallyNotifyRequesters &&
            NotificationMode == settings.NotificationMode &&
            NotificationChannels.SequenceEqual(settings.NotificationChannels) &&
            AutomaticallyPurgeCommandMessages == settings.AutomaticallyPurgeCommandMessages);
 }
        public IHttpActionResult EditMovies(dynamic m)
        {
            int    movieId = int.Parse(m.movie.MovieID.ToString());
            Movies movie   = context.Movies.Where(x => x.MovieID == movieId).FirstOrDefault();

            movie.AgeRestrictionID  = m.movie.AgeRestrictionID;
            movie.GenreID           = m.movie.GenreID;
            movie.Name              = m.movie.Name;
            movie.OriginalName      = m.movie.OriginalName;
            movie.ReleaseYear       = m.movie.ReleaseYear;
            movie.PictureBytes      = m.movie.PictureBytes;
            movie.Synopsis          = m.movie.Synopsis;
            movie.DurationInMinutes = m.movie.DurationInMinutes;
            movie.Trailer           = m.movie.Trailer;
            movie.ImageThumb        = m.movie.ImageThumb;
            movie.IsCurrent         = m.movie.IsCurrent;
            movie.IsDeleted         = false;
            movie.MovieDirectorID   = m.movie.MovieDirectorID;
            context.SaveChanges();

            //List<Actors> actors = JsonConvert.DeserializeObject<List<Actors>>(m.movieActor.ToString());

            foreach (MovieRoles mr in context.MovieRoles.Where(x => x.MovieID == movieId).ToList())
            {
                context.MovieRoles.Remove(mr);
                context.SaveChanges();
            }


            foreach (int id in m.movieActor)
            {
                MovieRoles mr = new MovieRoles();
                mr.MovieID   = movie.MovieID;
                mr.ActorID   = id;
                mr.IsDeleted = false;

                context.MovieRoles.Add(mr);
                context.SaveChanges();
            }

            return(Ok(new { MovieId = movie.MovieID }));
        }