コード例 #1
0
ファイル: movieBLC.cs プロジェクト: bsdangra/movieShuvie
        //store new data
        public void enterDataBLC(movies movie, producers producer, List <actors> actor, List <string> actorsDB, string producersDB)
        {
            List <String> tmpActName = new List <string>();
            movieDAL      dal        = new movieDAL();

            if (!dal.Movies.Any(x => x.movieName.Contains(movie.movieName)))
            {
                dal.Movies.Add(movie);

                //to add producer
                if (producersDB == "" || producersDB == null)
                {
                    if (!dal.Producers.Any(x => x.producerName.Contains(producer.producerName)))
                    {
                        dal.Producers.Add(producer);
                    }
                }
                else
                {
                    producer.producerName = producersDB;
                }

                //for adding actors
                foreach (actors item in actor)
                {
                    tmpActName.Add(item.actorName);

                    if (!dal.Actors.Any(x => x.actorName.Contains(item.actorName)))
                    {
                        dal.Actors.Add(item);
                    }
                }
                if (actorsDB != null)
                {
                    tmpActName.AddRange(actorsDB);
                }

                //save to db
                if (dal.SaveChanges() > 0)
                {
                    dal.enterDataDAL(movie.movieName, tmpActName, producer.producerName);
                }
            }
        }
コード例 #2
0
ファイル: movieBLC.cs プロジェクト: bsdangra/movieShuvie
        public void enterEditData(movies movie, List <actors> actors, List <actors> newActors, producers producer)
        {
            movieDAL dal = new movieDAL();

            dal.enterEditDataDAL(movie, actors, newActors, producer);
        }