ASP.Net Project Resume Templater

Hi All,
I am blocked on the additional challenge (task 15) of the project Resume Templater from ASP.Net skill path. In particular I am not able to complete the last point of this task:

Link:

  1. Navigate to /Models/Link.cs. Create another model class called Link, with properties LinkType and URLPath that a PageModel can set to pass it to the partial to render. The class should have a constructor that takes in a linkType of type LinkType (you can create an enum property for this holding Github and LinkedIn) and a urlPath of type string.

For more information on the enum property please visit the official documentation

  1. Update the _Links.cshtml partial to use Link as the new model and URLPath as the placeholder for the URL usernames.
  2. Update the use of the partial in Index.cshtml and Projects.cshtml to use a new instance of Link and pass in the correct values for linkType and urlPath in the constructor.

following their suggestion:

Link:

  1. Create an enum property, LinkType, that will hold only two values: Github and LinkedIn. We can then create a new property, Type, of data type LinkType and use it in the constructor.
  2. The _Links.cshtml partial access the URLPath using the @Model keyword: @Model.URLPath.
  3. Instead of using the for attribute, we can pass in a new instance of Link through the model attribute: model="@new Link(LinkType.GitHub, Model.GithubUsername)"

It give me an error about the name “LinkType” don’t exist. Following mine implementation for this point:

Link.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ResumeTemplater.Models
{
  // Additional Challenge
	public class Link
	{
    public enum LinkType
    {
      Github,
      LinkedIn,
    }
    public string URLPath {get; set;}
    public LinkType Type {get; set;}
		
    public Link(LinkType linkType, string urlPath)
    {
      Type = linkType;
      URLPath = urlPath;
    }
	}
}

_Links.cshtml:

<!-- _Links.cshtml -->
@model Link
<!-- Create partial below -->
@if(ViewData["Title"]=="Home")
{
    <a asp-protocol="https"
       asp-host="www.linkedin.com"
       asp-controller="@Model.URLPath">
       @Model.Type
    </a>
}
else if (ViewData["Title"]=="Projects")
{
    <a asp-protocol="https"
       asp-host="github.com"
       asp-controller="@Model.URLPath">
       @Model.Type
    </a>
}

index.csh (esecution of the partial):

<partial name="_Links" model = "@new Link(LinkType.LinkedIn, Model.LinkedInUsername)"/>

Thanks to everyone will help :slight_smile: