public MovieDataSourcePersonData(string name, string imdbId, int tmdbId, int sortOrder, Cast.Jobs job, string roleName)
 {
     _name = name;
     _imdbId = imdbId;
     _tmdbId = tmdbId;
     _sortOrder = sortOrder;
     _job = job;
     _roleName = roleName;
 }
Ejemplo n.º 2
0
 public void AddCastMember(Cast.Jobs job, string name, string imdbId, int tmdbId, int sortOrder, string roleName)
 {
     if (this.EntityState == System.Data.EntityState.Added)
         throw new InvalidOperationException("Can not add cast to new movie");
     var person = MovieSystemService.GetOrCreatePerson(name, imdbId, tmdbId);
     var cast = Cast.CreateCast(0, job.ToString(), person.Id, Id);
     cast.SortOrder = sortOrder;
     cast.RoleName = !string.IsNullOrWhiteSpace(roleName) ? roleName : null;
     MovieSystemService.DbEntities.AddToCasts(cast);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create a new Cast object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="job">Initial value of the Job property.</param>
 /// <param name="personId">Initial value of the PersonId property.</param>
 /// <param name="movieId">Initial value of the MovieId property.</param>
 public static Cast CreateCast(global::System.Int32 id, global::System.String job, global::System.Int32 personId, global::System.Int32 movieId)
 {
     Cast cast = new Cast();
     cast.Id = id;
     cast.Job = job;
     cast.PersonId = personId;
     cast.MovieId = movieId;
     return cast;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Casts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCasts(Cast cast)
 {
     base.AddObject("Casts", cast);
 }
Ejemplo n.º 5
0
 private IList<Cast> GetSortedJob(Cast.Jobs job)
 {
     if (!_movie.Casts.IsLoaded)
         _movie.Casts.Load();
     var jobStr = job.ToString();
     return (from c in _movie.Casts where c.Job == jobStr orderby c.SortOrder select c).ToList();
 }
Ejemplo n.º 6
0
 public void ClearType(Cast.Jobs type)
 {
     var toDel = Casts.Where(el => el.Job == type.ToString()).ToList();
     foreach (var del in toDel)
         Casts.Remove(del);
 }