本文整理汇总了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);
}
示例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));
}
示例3: Suggestion
public ActionResult Suggestion(Movie movie)
{
var movieSuggestions = new Core.ServiceBus.Topic.MovieSuggestions();
movieSuggestions.Send(movie);
return RedirectToAction("Index", "Home");
}
示例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;
}
示例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();
}
示例6: Remove
public void Remove(Movie movie)
{
if (_movies.Contains(movie))
{
_movies.Remove(movie);
}
}
示例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);
}
示例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 ();
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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);
}
}
示例14: Character
public Character(string name, Movie movie, Actor actor)
: this()
{
Name = name;
Movie = movie;
Actor = actor;
}
示例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);
}