public void Begin(IProcessRunner processRunner, IActorRepository repository) { _clock.Reset(); Double duration = TimeSpan.FromMilliseconds(0).TotalMilliseconds; foreach (var child in Children) { Actor target = null; if (!String.IsNullOrEmpty(child.TargetName)) target = repository.GetActorByName(child.TargetName); else if (child.TargetActor != null) target = child.TargetActor; else throw new Exception("A storyboard child was found that did not specify an actor name or actor."); var targetProperty = child.TargetProperty; child.Timeline.SetActor(target); child.Timeline.ApplyAnimationClock(_clock); child.Timeline.BeginAnimation(targetProperty); duration = Math.Max(child.Timeline.GetNaturalDuration().TotalMilliseconds, duration); } processRunner.ScheduleProcess(new AnimationClockController(_clock, TimeSpan.FromMilliseconds(duration))); }
public void AddMovie(MovieDTO movieDTO) { int movieId = _movieRepository.AddMovie(movieDTO); if (movieDTO.Actors == null || !movieDTO.Actors.Any()) { return; } List <int> actorsIds = new List <int>(); foreach (string actor in movieDTO.Actors) { ActorDTO actorFromDb = _actorRepository.GetActorByName(actor); if (actorFromDb == null) { actorsIds.Add(_actorRepository.AddActor(new ActorDTO { ActorName = actor })); } else { actorsIds.Add(actorFromDb.ActorId); } } foreach (int actorId in actorsIds) { _actorRepository.AddActorByMovieId(actorId, movieId); } }
public ActionResult <IEnumerable <ActorDTO> > GetActorListByName(String fullname = "") { var actor = _userRepo.GetActorByName(fullname).ToList(); if (actor.Count == 0) { return(NotFound("Khong tim thay user")); } return(Ok(actor)); }