Ejemplo n.º 1
0
 public AuthorEntity MapAuthorDetailModelToEntity(AuthorDetailModel authorDetailModel)
 {
     return(new AuthorEntity
     {
         Id = authorDetailModel.Id,
         FirstName = authorDetailModel.FirstName,
         LastName = authorDetailModel.LastName,
         AboutAuthor = authorDetailModel.AboutAuthor,
         Recipes = authorDetailModel.Recipes == null ? null : authorDetailModel.Recipes.Select(MapRecipeListModelToEntity).ToList()
     });
 }
Ejemplo n.º 2
0
        // Gets information from specific author and returns it to the view
        public IActionResult Detail(int id)
        {
            var model = new AuthorDetailModel();

            var author = _authorService.GetFromID(id);

            model.ID = id;
            model.Books = _authorService.GetAllBooksFromAuthor(id);
            model.Name = author.Name;

            return View(model);
        }
Ejemplo n.º 3
0
        public IActionResult AuthorDetails(string author)
        {
            if (author == null)
            {
                return(NotFound());
            }
            Author Author = _authorServices.GetAuthorDetails(author);


            var model = new AuthorDetailModel
            {
                Authors  = Author,
                Articles = Author.ArticleAuthors
                           .Select(i => i.Articles).ToList(),
                News = Author.newsAuthors
                       .Select(i => i.News).ToList(),
            };

            return(View(model));
        }