当前位置: 首页>>代码示例>>C#>>正文


C# Movie类代码示例

本文整理汇总了C#中Movie的典型用法代码示例。如果您正苦于以下问题:C# Movie类的具体用法?C# Movie怎么用?C# Movie使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Movie类属于命名空间,在下文中一共展示了Movie类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

        public ActionResult Create(MovieViewModel model)
        {
            var maleActor = db.Actors.Find(model.LeadingMaleRoleId);
            var femaleActor = db.Actors.Find(model.LeadingFemaleRoleId);
            var studio = db.Studios.Find(model.StudioId);

            if (maleActor != null && femaleActor != null && studio != null)
            {
                var movie = new Movie();
                movie.Title = model.Title;
                movie.Year = model.Year;
                movie.Director = model.Director;
                movie.LeadingMaleRole = maleActor;
                movie.LeadingFemaleRole = femaleActor;
                movie.Studio = studio;

                if (ModelState.IsValid)
                {
                    db.Movies.Add(movie);
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }
            }

            ViewBag.MaleActors = db.Actors.ToList().Where(a => a.Gender == Gender.Male).Select(a => new SelectListItem { Text = a.Name, Value = a.Id.ToString() });
            ViewBag.FemaleActors = db.Actors.ToList().Where(a => a.Gender == Gender.Female).Select(a => new SelectListItem { Text = a.Name, Value = a.Id.ToString() });
            ViewBag.Studios = db.Studios.ToList().Select(s => new SelectListItem { Text = s.Name, Value = s.Id.ToString() });

            return PartialView("_CreateMovie", model);
        }
开发者ID:sabrie,项目名称:TelerikAcademy,代码行数:30,代码来源:MoviesController.cs

示例2: Movies_Create

        public ActionResult Movies_Create([DataSourceRequest]DataSourceRequest request, MovieAdminViewModel model)
        {
            if (ModelState.IsValid && model != null)
            {
                //var movie = Mapper.Map<Movie>(model);
                var newId = 7;
                var movie = new Movie()
                {
                    Title = model.Title,
                    Year = model.Year,
                    PosterId = model.PosterId,
                    DirectorId = model.DirectorId,
                    StudioId = model.StudioId,
                    Summary = model.Summary,
                    CreatedOn = model.CreatedOn,
                    ModifiedOn = model.ModifiedOn,
                    IsDeleted = model.IsDeleted,
                    DeletedOn = model.DeletedOn

                };

                var result = this.movies.Add(movie);
                newId = movie.Id;
                Mapper.Map(result, model);
            }

            return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        }
开发者ID:Vyara,项目名称:SciHub,代码行数:28,代码来源:MoviesController.cs

示例3: Suggestion

        public ActionResult Suggestion(Movie movie)
        {
            var movieSuggestions = new Core.ServiceBus.Topic.MovieSuggestions();
            movieSuggestions.Send(movie);

            return RedirectToAction("Index", "Home");
        }
开发者ID:joaroyen,项目名称:OneStepIntoTheCloud,代码行数:7,代码来源:MovieController.cs

示例4: createOrUpdateFilm

 public Film createOrUpdateFilm(Film film)
 {
     if(film.ID != null && film.ID != new Guid("00000000-0000-0000-0000-000000000000"))
     {
         var movie = model.Movie.Find(film.ID);
         movie.OriginalTitle = film.name;
         movie.ReleaseDate = film.date;
         model.Entry(movie).State = EntityState.Modified;
         model.SaveChanges();
     }
     else
     {
         var movie = new Movie
         {
             OriginalTitle = film.name,
             RussianTitle = "",
             ReleaseDate = film.date,
             MovieId = Guid.NewGuid()
         };
         model.Movie.Add(movie);
         model.SaveChanges();
         film.ID = movie.MovieId;
     }
     return film;
 }
开发者ID:tscherkas,项目名称:filmsWebApp,代码行数:25,代码来源:FilmsDAL_EF.cs

示例5: LikeMovie

 public void LikeMovie(Movie movie)
 {
     Console.ForegroundColor = ConsoleColor.Yellow;
     Console.WriteLine($"Movie: {movie.Name} ({movie.Year}) by {movie.Sender.Name} \r\n\t{movie.Sender.ImageUrl}");
     Console.WriteLine();
     Console.ResetColor();
 }
开发者ID:bnayae,项目名称:SDP-2015,代码行数:7,代码来源:ImdbEvents.cs

示例6: Remove

 public void Remove(Movie movie)
 {
     if (_movies.Contains(movie))
     {
         _movies.Remove(movie);
     }
 }
开发者ID:kimtz,项目名称:CIKMovies,代码行数:7,代码来源:FakeStorage.cs

示例7: GenresTest

        public void GenresTest() {
            //Upload a file
            MemoryStream s = new MemoryStream();
            s.WriteByte(5);
            int tmpId = db.UploadFile(s);
            //Create a movie with genres horror, comedy and action
            IList<string> expectedGenres = new List<string> { "Horror", "Comedy", "Action" };
            Movie mov = new Movie()
            {
                Title = "title",
                Year = 1900,
                BuyPrice = 1000,
                RentPrice = 100,
                Description = "description"
            };
            Movie movie = db.CreateMovie(1, tmpId, expectedGenres, mov, new List<string>{"director"});
            
            //Retrieve the movie from the database and check that the genres match the inserted
            Movie actMovie = db.GetMovie(movie.Id);
            IList<string> actualGenres = actMovie.Genres;
            Assert.AreEqual(expectedGenres.Count, actualGenres.Count);
            foreach (string genre in expectedGenres) {
                Assert.IsTrue(actualGenres.Contains(genre));
            }

            db.DeleteMovie(movie.Id, 1);
        }
开发者ID:Bladtman242,项目名称:ITU.Year2.RentIt,代码行数:27,代码来源:FileTest.cs

示例8: OnCreate

		protected override void OnCreate (Bundle savedInstanceState) {
			base.OnCreate (savedInstanceState);

			// Set our view from the "main" layout resource
			this.SetContentView (Resource.Layout.movie_detail);

			// Create your application here
			var strConfig = this.Intent.Extras.GetString ("Configuration");
			var strSelectedMovie = this.Intent.Extras.GetString ("SelectedMovie");
			this.configuration = JsonConvert.DeserializeObject<ConfigurationResponse> (strConfig);
			this.movieDetail = JsonConvert.DeserializeObject<Movie> (strSelectedMovie);

			this.btnPlay = this.FindViewById<Button> (Resource.Id.movie_detail_btnPlay);
			this.btnPlay.Click += this.btnPlay_Click;
			this.btnFavorite = this.FindViewById<Button> (Resource.Id.movie_detail_btnFavorite);
			this.btnFavorite.Click += this.btnFavorite_Click;
			this.btnClose = this.FindViewById<ImageButton> (Resource.Id.movie_detail_close);
			this.btnClose.Click += this.btnClose_Click;
			this.txtTitle = this.FindViewById<TextView> (Resource.Id.movie_detail_txtTitle);
			this.txtReleaseDate = this.FindViewById<TextView> (Resource.Id.movie_detail_txtReleaseDate);
			this.ratingBar = this.FindViewById<RatingBar> (Resource.Id.movie_detail_ratingBar);
			this.txtVoteCount = this.FindViewById<TextView> (Resource.Id.movie_detail_txtVoteCount);
			this.txtOverview = this.FindViewById<TextView> (Resource.Id.movie_detail_txtOverview);
			this.imgPoster = this.FindViewById<ImageView> (Resource.Id.movie_detail_imgPoster);
			this.vwSimilarMovies = this.FindViewById<RelativeLayout> (Resource.Id.movie_detail_vwSimilarMovies);
			this.movieList = this.FindViewById<RecyclerView>(Resource.Id.movie_detail_lstSimilarMovies);
			this.movieLayoutManager = new LinearLayoutManager (this, LinearLayoutManager.Horizontal, false);
			this.movieList.SetLayoutManager (this.movieLayoutManager);

			this.updateLayout ();
		}
开发者ID:Robert-Altland,项目名称:MovieExplorer,代码行数:31,代码来源:MovieDetailActivity.cs

示例9: BitmapClip

	public BitmapClip(LWF lwf, Movie parent, int objId)
		: base(lwf, parent, objId)
	{
		var data = lwf.data.bitmaps[objId];
		var fragment = lwf.data.textureFragments[data.textureFragmentId];
		var texdata = lwf.data.textures[fragment.textureId];
		width = fragment.w / texdata.scale;
		height = fragment.h / texdata.scale;
		offsetX = fragment.x;
		offsetY = fragment.y;
		originalWidth = fragment.ow;
		originalHeight = fragment.oh;

		depth = -1;
		visible = true;

		regX = 0;
		regY = 0;
		x = 0;
		y = 0;
		scaleX = 0;
		scaleY = 0;
		rotation = 0;
		alpha = 1;

		_scaleX = scaleX;
		_scaleY = scaleY;
		_rotation = rotation;
		_cos = 1;
		_sin = 0;

		_matrix = new Matrix();
	}
开发者ID:DelSystem32,项目名称:lwf,代码行数:33,代码来源:lwf_bitmapclip.cs

示例10: Text

        public Text(LWF lwf, Movie p, int objId, int instId = -1)
            : base(lwf, p, Format.Object.Type.TEXT, objId)
        {
            Format.Text text = lwf.data.texts[objId];
            m_dataMatrixId = text.matrixId;

            if (text.nameStringId != -1) {
            m_name = lwf.data.strings[text.nameStringId];
            } else {
            if (instId >= 0 && instId < lwf.data.instanceNames.Length) {
                int stringId = lwf.GetInstanceNameStringId(instId);
                if (stringId != -1)
                    m_name = lwf.data.strings[stringId];
            }
            }

            TextRenderer textRenderer =
            lwf.rendererFactory.ConstructText(lwf, objId, this);

            string t = null;
            if (text.stringId != -1)
            t = lwf.data.strings[text.stringId];

            if (text.nameStringId == -1 && string.IsNullOrEmpty(name)) {
            if (text.stringId != -1)
                textRenderer.SetText(t);
            } else {
            lwf.SetTextRenderer(p.GetFullName(), name, t, textRenderer);
            }

            m_renderer = textRenderer;
        }
开发者ID:yonekawa,项目名称:lwf,代码行数:32,代码来源:lwf_text.cs

示例11: BitmapClip

        public BitmapClip(LWF lwf, Movie parent, int objId)
            : base(lwf, parent, objId)
        {
            m_dataMatrixId = lwf.data.bitmaps[objId].matrixId;
            var data = lwf.data.bitmaps[objId];
            var fragment = lwf.data.textureFragments[data.textureFragmentId];
            var texdata = lwf.data.textures[fragment.textureId];
            width = fragment.w / texdata.scale;
            height = fragment.h / texdata.scale;
            m_renderer = lwf.rendererFactory.ConstructBitmap(lwf, objId, this);

            depth = -1;
            visible = true;

            regX = 0;
            regY = 0;
            x = 0;
            y = 0;
            scaleX = 0;
            scaleY = 0;
            rotation = 0;
            alpha = 1;

            _scaleX = scaleX;
            _scaleY = scaleY;
            _rotation = rotation;
            _cos = 1;
            _sin = 0;

            _matrix = new Matrix();
        }
开发者ID:rayyee,项目名称:lwf,代码行数:31,代码来源:lwf_bitmapclip.cs

示例12: CopyMovieInfos

        private MovieTag CopyMovieInfos(MovieTag movieTag, Movie movie)
        {
            movieTag.Title = movie.Title;
              movieTag.IMDB_ID = movie.ImdbId;
              movieTag.TMDB_ID = movie.Id.ToString();

              MovieCollection collection = movie.Collection;
              movieTag.CollectionTitle = collection != null ? collection.Name : null;

              movieTag.ReleaseDate = movie.ReleaseDate.HasValue ? movie.ReleaseDate.Value.ToString("yyyy-MM-dd") : null;
              movieTag.Overview = movie.Overview;
              movieTag.Tagline = movie.Tagline;

              //todo: implement certification
              //movieTag.Certification = movie.

              movieTag.Genres = movie.Genres.Select(g => g.Name).ToList().AsReadOnly();

              MovieCasts casts = movieDbApi.GetCastCrew(movie.Id);
              if (casts == null)
            return movieTag;

              movieTag.Actors = casts.Cast.Select(p => p.Name).ToList().AsReadOnly();
              movieTag.Directors = casts.Crew.Where(p => p.Job == "Director").Select(p => p.Name).ToList().AsReadOnly();
              movieTag.Writers = casts.Crew.Where(p => p.Job == "Author").Select(p => p.Name).ToList().AsReadOnly();

              return movieTag;
        }
开发者ID:ChristophvdF,项目名称:MkvTagger,代码行数:28,代码来源:TheMovieDbImporter.cs

示例13: Main

        static void Main()
        {
            try {
                Configuration configuration = new Configuration();
                configuration.AddAssembly(typeof (Movie).Assembly);
                ISessionFactory SessionFactory = configuration.BuildSessionFactory();
                ISession session = SessionFactory.OpenSession();

                using (ITransaction transaction = session.BeginTransaction())
                {
                    Movie movie = new Movie();
                    movie.Title = "SpiderMan";
                    movie.Author = "Warner";
                    session.Save(movie);
                    transaction.Commit();
                }

                IQuery query = session.CreateQuery("FROM Movie");
                IList<Movie> movies = query.List<Movie>();
                Debug.WriteLine("count" + movies.Count);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.StackTrace);
            }
        }
开发者ID:jpisoard,项目名称:myrepository,代码行数:26,代码来源:StartClass.cs

示例14: Character

 public Character(string name, Movie movie, Actor actor)
     : this()
 {
     Name = name;
     Movie = movie;
     Actor = actor;
 }
开发者ID:modulexcite,项目名称:2015-Slides-and-Demos,代码行数:7,代码来源:Character.cs

示例15: AddMovie_should_add_the_movie_to_the_collection

        public void AddMovie_should_add_the_movie_to_the_collection()
        {
            var movie = new Movie(1, "Test");
            _collection.AddMovie(movie);

            _collection.Movies.Should().Contain(movie);
        }
开发者ID:JAkerblom,项目名称:FFCG.JAkerblom.Movies,代码行数:7,代码来源:MovieCollectionTests.cs


注:本文中的Movie类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。