本文整理汇总了C#中Movie类的典型用法代码示例。如果您正苦于以下问题:C# Movie类的具体用法?C# Movie怎么用?C# Movie使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Movie类属于命名空间,在下文中一共展示了Movie类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: MovieEditorWindowViewModel
public MovieEditorWindowViewModel(IMovieEditorWindow view, Movie movie, MovieRepository repository)
{
if (movie == null)
{
createMode = true;
movie = new Movie();
}
this.view = view;
this.repository = repository;
Movie = movie;
Genres = new ObservableCollection<Genre>(repository.GetGenres());
AgeLimits = repository.GetAgeLimits().ToList();
if (createMode) return;
var limit = AgeLimits.FirstOrDefault(_ => _.Id == movie.AgeLimit.Id);
view.SelectedAgeLimitIndex = AgeLimits.IndexOf(limit);
var selectedGenres = Genres.Join(movie.Genres,
genre => genre.Id,
genre => genre.Id,
(genre1, genre2) => genre1).ToList();
selectedGenres.ForEach(_ => _.IsSelected = true);
}
开发者ID:nuc134r,项目名称:CinemaTicketOffice,代码行数:27,代码来源:MovieEditorWindowViewModel.cs
示例17: ChangeButtonsStatuses
private async Task ChangeButtonsStatuses(Movie movie)
{
//MessageBox.Show("movie");
HttpClient httpClient = new HttpClient();
httpClient.BaseAddress = new Uri((App.Current as App).filmapApiUrl);
var response = await httpClient.GetAsync("/films/" + movie.imdbID + "?token=" + (App.Current as App).accessToken);
var str = response.Content.ReadAsStringAsync().Result;
try
{
FilmapFilm film = JsonConvert.DeserializeObject<FilmapFilm>(str);
if (film.watched == 1)
{
button1.Content = "Watched";
button1.IsEnabled = false;
button.IsEnabled = false;
}
else if (film.watched == 0)
{
button.IsEnabled = false;
button.Content = "Watch later";
}
}
catch (Exception e)
{
Console.WriteLine(e.StackTrace);
}
}
开发者ID:Filmap,项目名称:filmap-wp8,代码行数:32,代码来源:MoviePage.xaml.cs
示例18: PutMovie
public IHttpActionResult PutMovie(int id, Movie movie)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
if (id != movie.Id)
{
return BadRequest();
}
db.Entry(movie).State = EntityState.Modified;
try
{
db.SaveChanges();
}
catch (DbUpdateConcurrencyException)
{
if (!MovieExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return StatusCode(HttpStatusCode.NoContent);
}
开发者ID:anyangmaxin,项目名称:ASP.NETMVC5GaoJiBianChengDi5Ban,代码行数:32,代码来源:MovieController.cs
示例19: OnAddItem
protected override void OnAddItem(Movie video, bool select)
{
var found = false;
LogManager.Log("Adding items to Veritcal gallery");
foreach (Control c in this.tableLayoutPanel.Controls)
{
var widget = c as LinkViewWidget;
if (widget != null)
{
var link = widget.Video as MovieLink;
if(link.DowloadUrl == video.Url)
{
widget.SelectView();
found = true;
}
else
widget.DeselectView();
}
}
if (!found)
{
foreach (var link in video.Links)
{
var widget = AddItem(link);
//this.tableLayoutPanel.Controls.SetChildIndex(widget, 0);
}
if (select)
{
var widget = this.tableLayoutPanel.Controls[0] as LinkViewWidget;
widget.SelectView();
}
}
}
开发者ID:huoxudong125,项目名称:VideoSearch,代码行数:34,代码来源:VerticalSingleColumnGalleryWidget.cs
示例20: btnAdd_Click
protected void btnAdd_Click(object sender, EventArgs e)
{
bool isAlreadyExists;
using (var context = new MyMoviesContext())
{
var movie = new Movie
{
Title = tbTitle.Text,
Year = Int32.Parse(tbYear.Text),
Genre = context.Genres.Find(Int32.Parse(ddlGenre.SelectedItem.Value))
};
isAlreadyExists = context.Movies.FirstOrDefault(x => x.Title == movie.Title && x.Year == movie.Year && x.GenreId == movie.Genre.Id) != null;
if (!isAlreadyExists)
{
context.Movies.Add(movie);
context.SaveChanges();
}
}
if (isAlreadyExists)
{
Response.Redirect(Request.Url.AbsoluteUri.Substring(0,
Request.Url.AbsoluteUri.Count() - Request.Url.Query.Count()) + "?movieAction=exist");
}
else
{
Response.Redirect("~/Default.aspx");
}
}
开发者ID:nancy-bree,项目名称:MyMovies,代码行数:28,代码来源:NewMovie.aspx.cs
注:本文中的Movie类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论