Okay well I thought that was the piece I needed but itsn’t not. I have been looking around for a solution and regarless of what I have tried I can’t seem to get anywhere. Was wondering if someone could give me some direction here. I know its something with your system that I am just not understanding how they fit together. You guys I don’t believe are doing anything wrong but I know there is a small piece I am trying to make work.
My Goal
I need to pull my Author Model and render the content on the page for that as well as I want to target SPECIFIC items in the Media and put them where I want them on a page. I thought using a viewModel would get me what I wanted. Any direction you can give me would be amazing. Trying to learn Contentful so that I can start working more heavily with it.
Github Repo (https://github.com/Moser2010/WhoAmI) on the test branch for this issue.
MVC
Model
using Contentful.Core.Configuration;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ContentfulMVC.Models;
using Contentful.Core.Models;
namespace ContentfulMVC.Models.ViewModels
{
public class WhoIAm
{
public Author Author { get; set; }
public List Assets { get; set; }//This doesn’t seem to refrence all the media images
}
}
Controller
public async Task WhoIAm()
{
WhoIAm AAI = new WhoIAm();
AAI.Author = await _client.GetEntry(“56WvqVr1oIOGqScqoY6EYK”);
var Assets = await _client.GetAssets();
return View(“WhoIAm”, AAI);
}
View
@model ContentfulMVC.Models.ViewModels.WhoIAm
< img class=“hImage” src="@Model.Assets.File.URL" />
< contentful-image asset-id=“5na3PJ1om4eyAQcmia0S8y” />