Ejemplo n.º 1
0
        public async Task <ExtendedActorDTO> AddActor(ExtendedActorDTO actor)
        {
            Actor newActor = _mapper.Map <Actor>(actor);
            await _actorRepository.AddActor(newActor);

            return(actor);
        }
Ejemplo n.º 2
0
 public async Task <ActionResult <ExtendedActorDTO> > AddActor(ExtendedActorDTO actor)
 {
     try
     {
         return(new OkObjectResult(await _movieService.AddActor(actor)));
     }
     catch
     {
         return(new StatusCodeResult(500));
     }
 }
Ejemplo n.º 3
0
        public async Task Add_Actor()
        {
            var actor = new ExtendedActorDTO()
            {
                IMDBActorId = "nm0001618",
                Name        = "Joaquin Phoenix",
                Born        = new DateTime(1974, 10, 28)
            };

            string json     = JsonConvert.SerializeObject(actor);
            var    response = await Client.PostAsync("/api/actors", new StringContent(json, Encoding.UTF8, "application/json"));

            response.StatusCode.Should().Be(HttpStatusCode.OK);

            var createdActor = JsonConvert.DeserializeObject <ExtendedActorDTO>(await response.Content.ReadAsStringAsync());

            Assert.NotNull(createdActor);
        }