Ejemplo n.º 1
0
        public void Insert_NewActorWithoutFilms()
        {
            var actorDetailModel = new ActorDetailModel()
            {
                FirstName     = "Emil_test",
                SecondName    = "Jasson_test",
                Age           = 50,
                WikiUrl       = "SomeURLPath",
                PhotoFilePath = "SomePhotoPath",
            };

            var returnedDetailModel = facadeTestUnit.Save(actorDetailModel);

            // Synchronizing Ids
            actorDetailModel.Id = returnedDetailModel.Id;

            Assert.NotNull(returnedDetailModel);
            Assert.Equal(actorDetailModel, returnedDetailModel, ActorDetailModel.ActorDetailModelComparer);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Detail(int id)
        {
            Actor actor = await _actors.GetById(id);

            if (actor != null)
            {
                List <Movie> movies = await _actors.GetMovies(id);

                var detailModel = new ActorDetailModel
                {
                    Id         = actor.Id,
                    Name       = actor.Name,
                    Birthday   = actor.Birthday.Equals(DateTime.MinValue) ? "" : actor.Birthday.ToString("MMMM dd yyyy"),
                    Birthplace = actor.Birthplace,
                    Bio        = actor.Bio,
                    Movies     = movies
                                 .Select(movie => new KeyValuePair <int, string>(movie.Id, movie.Title))
                                 .ToDictionary(kvp => kvp.Key, kvp => kvp.Value)
                };
                return(View(detailModel));
            }

            return(NotFound());
        }