Exemple #1
0
        /// <summary>
        /// Add a new movie into DB
        /// </summary>
        /// <param name="movieinput">Movie info</param>
        /// <returns></returns>
        public bool AddMovie(MovieModel movieinput)
        {
            Movie _movie = new Movie();

            _movie.MovieName   = movieinput.MovieName;
            _movie.Plot        = movieinput.Plot;
            _movie.ReleaseYear = movieinput.ReleaseYear;
            _movie.Producer    = Db.Producers.FirstOrDefault(s => s.ProducerID == movieinput.ProducerId);
            Db.Movies.InsertOnSubmit(_movie);

            List <Movie_Actor> _actors = movieinput.ActorsArray.Select(a => new Movie_Actor {
                Actor = Db.Actors.FirstOrDefault(s => s.ActorId == a), Movie = _movie
            }).ToList();

            Db.Movie_Actors.InsertAllOnSubmit(_actors);

            Db.SubmitChanges();
            return(true);
        }
Exemple #2
0
        /// <summary>
        /// Add new Actor
        /// </summary>
        /// <param name="proinput"></param>
        /// <returns></returns>
        public bool AddNewActor(ActorModel proinput)
        {
            Actor _actor = new Actor();

            _actor.ActorName   = proinput.ActorName;
            _actor.DateOfBirth = proinput.DOB;
            _actor.Bio         = proinput.Bio;
            _actor.Gender      = Convert.ToBoolean(proinput.Gender);
            Db.Actors.InsertOnSubmit(_actor);
            Db.SubmitChanges();
            return(true);
        }
Exemple #3
0
        public bool AddNewProducer(ProducerModel proinput)
        {
            Producer _producer = new Producer();

            _producer.ProducerName = proinput.ProducerName;
            _producer.DateOfBirth  = proinput.DOB;
            _producer.Bio          = proinput.Bio;
            _producer.Gender       = Convert.ToBoolean(proinput.Gender);
            Db.Producers.InsertOnSubmit(_producer);
            Db.SubmitChanges();
            return(true);
        }