Ejemplo n.º 1
0
        public ActionResult AddActor()
        {
            var AllActor = new SelectList(_ActRep.GetActor().ToList(), "Actor_Id", "Actor_Name");

            ViewData["AllActor"] = AllActor;
            var AllMovie = new SelectList(_MovieRep.GetMovie().ToList(), "Movie_Id", "Movie_Name");

            ViewData["AllMovie"] = AllMovie;
            return(View());
        }
Ejemplo n.º 2
0
        //********************Implementation********************

        //Display
        public ActionResult Index()
        {
            var AllActor = from Actor in _ActorRep.GetActor()
                           select Actor;

            return(View(AllActor));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> CreateActor([FromBody] ActorResource actorResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var actor = mapper.Map <ActorResource, Actor>(actorResource);

            repository.Add(actor);
            await unitOfWork.CompleteAsync();

            actor = await repository.GetActor(actor.Id);

            var result = mapper.Map <Actor, ActorResource>(actor);

            return(Ok(result));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult <ActorDTO> > GetActor(int id)
        {
            var actor = await _actorRepository.GetActor(id).ConfigureAwait(false);

            if (actor == null)
            {
                return(NotFound());
            }

            return(actor);
        }
Ejemplo n.º 5
0
        public ActorDto Handle(GetActorQuery query)
        {
            var actor = _actorRepository.GetActor(query.Id);

            return(new ActorDto
            {
                Name = actor.Name,
                Balance = actor.Balance.Name,
                Experience = actor.Experience,
                CurrentHealth = actor.CurrentHealth,
                Health = actor.Health,
                Power = actor.Power,
                Speed = actor.Speed,
                Quality = actor.Quality.Name
            });
        }
        public async Task <ActionResult <GetActorModel> > GetActor(string id)
        {
            try
            {
                if (!Guid.TryParse(id, out Guid actorId))
                {
                    throw new GuidException("Invalid id", this.GetType().Name, "GetActor", "400");
                }

                return(await _actorRepository.GetActor(id));
            }
            catch (MovieMindException e)
            {
                if (e.MovieMindError.Status.Equals("404"))
                {
                    return(NotFound(e.MovieMindError));
                }
                else
                {
                    return(BadRequest(e.MovieMindError));
                }
            }
        }
Ejemplo n.º 7
0
 public ActionResult <IEnumerable <ActorDTO> > GetActor()
 {
     return(Ok(_actorRepository.GetActor()));
 }
Ejemplo n.º 8
0
 public IEnumerable <Actor> Get()
 {
     return(_actorRepository.GetActor());
 }
Ejemplo n.º 9
0
 public async Task <Actor> GetActor(int id)
 {
     return(await _actorRepo.GetActor(id));
 }
Ejemplo n.º 10
0
 public async Task <ExtendedActorDTO> GetActor(String id)
 {
     return(_mapper.Map <ExtendedActorDTO>(await _actorRepository.GetActor(id)));
 }