Exemple #1
0
        public static bool Insert(Basic_Movie_Info info)
        {
            Basic_Movie_DAL _Basic_Movie = new Basic_Movie_DAL();

            if (info.Id == Guid.Empty)
            {
                return(false);
            }
            return(_Basic_Movie.Insert(info));
        }
Exemple #2
0
 public bool Insert(Basic_Movie_Info info)
 {
     using (MovieResShareEntities database = new MovieResShareEntities())
     {
         try
         {
             database.Basic_Movie.Add(ToDatabase(info));
             database.SaveChanges();
             return(true);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
Exemple #3
0
        public static Basic_Movie_Info ToModel(Basic_Movie movie)
        {
            Basic_Movie_Info info = new Basic_Movie_Info();

            info.Id             = movie.Id;
            info.Title          = movie.Title;
            info.Title_En       = movie.Title_En;
            info.Aka            = movie.Aka;
            info.Year           = (short)movie.Year;
            info.Website        = movie.Website;
            info.Current_Season = (short)movie.Current_Season;
            info.Season_Count   = (short)movie.Season_Count;
            info.Episode_Count  = (int)movie.Episode_Count;
            info.Pubdate        = movie.Pubdate;
            info.Duration       = movie.Duration;
            info.Douban         = movie.Douban;
            info.IMDb           = movie.IMDb;
            info.Summary        = movie.Summary;
            info.Collect_Count  = (long)movie.Collect_Count;
            info.Create_Time    = (DateTime)movie.Create_Time;
            info.Alter_Time     = (DateTime)movie.Alter_Time;
            info.Create_User    = (Guid)movie.Create_User;

            info.Poster = Step_Movie_Poster_DAL.ToModel(movie.Step_Movie_Poster.FirstOrDefault());
            info.Rating = Step_Movie_Rating_DAL.ToModel(movie.Step_Movie_Rating.FirstOrDefault());

            foreach (var item in movie.Step_Movie_Country)
            {
                info.Country.Add(Step_Movie_Country_DAL.ToModel(item));
            }

            foreach (var item in movie.Step_Movie_Genre)
            {
                info.Genre.Add(Step_Movie_Genre_DAL.ToModel(item));
            }

            foreach (var item in movie.Step_Movie_Lang)
            {
                info.Lang.Add(Step_Movie_Lang_DAL.ToModel(item));
            }

            return(info);
        }
Exemple #4
0
        public static Basic_Movie ToDatabase(Basic_Movie_Info info)
        {
            Basic_Movie movie = new Basic_Movie();

            movie.Id             = info.Id;
            movie.Title          = info.Title;
            movie.Title_En       = info.Title_En;
            movie.Aka            = info.Aka;
            movie.Year           = info.Year;
            movie.Website        = info.Website;
            movie.Current_Season = info.Current_Season;
            movie.Season_Count   = info.Season_Count;
            movie.Episode_Count  = info.Episode_Count;
            movie.Pubdate        = info.Pubdate;
            movie.Duration       = info.Duration;
            movie.Douban         = info.Douban;
            movie.IMDb           = info.IMDb;
            movie.Summary        = info.Summary;
            movie.Collect_Count  = info.Collect_Count;
            movie.Create_Time    = info.Create_Time;
            movie.Alter_Time     = info.Alter_Time;
            movie.Create_User    = info.Create_User;

            List <Step_Movie_Poster> poster = new List <Step_Movie_Poster>();

            poster.Add(new Step_Movie_Poster()
            {
                Id     = info.Poster.Id,
                Movie  = info.Poster.Movie,
                Large  = info.Poster.Large,
                Medium = info.Poster.Medium,
                Small  = info.Poster.Small
            });
            movie.Step_Movie_Poster = poster;

            List <Step_Movie_Rating> rating = new List <Step_Movie_Rating>();

            rating.Add(new Step_Movie_Rating()
            {
                Id        = info.Rating.Id,
                Movie     = info.Rating.Movie,
                Rated_Num = info.Rating.Rated_Num,
                Score     = info.Rating.Score,
                Star1     = info.Rating.Star1,
                Star2     = info.Rating.Star2,
                Star3     = info.Rating.Star3,
                Star4     = info.Rating.Star4,
                Star5     = info.Rating.Star5
            });
            movie.Step_Movie_Rating = rating;

            List <Step_Movie_Country> countries = new List <Step_Movie_Country>();

            foreach (var item in info.Country)
            {
                countries.Add(new Step_Movie_Country()
                {
                    Id      = item.Id,
                    Movie   = item.Movie,
                    Country = item.Country
                });
            }
            movie.Step_Movie_Country = countries;

            List <Step_Movie_Lang> langs = new List <Step_Movie_Lang>();

            foreach (var item in info.Lang)
            {
                langs.Add(new Step_Movie_Lang()
                {
                    Id    = item.Id,
                    Movie = item.Movie,
                    Lang  = item.Lang
                });
            }
            movie.Step_Movie_Lang = langs;

            List <Step_Movie_Genre> genres = new List <Step_Movie_Genre>();

            foreach (var item in info.Genre)
            {
                genres.Add(new Step_Movie_Genre()
                {
                    Id    = item.Id,
                    Movie = item.Movie,
                    Genre = item.Genre
                });
            }
            movie.Step_Movie_Genre = genres;

            return(movie);
        }