Stuck on the Additional Challenge found in Resume Templater Project in Build Web Apps with ASP.NET Skill Path

Hi,

Good day. I’m blocked on the additional challenge provided on the project for the Resume Templator on Skill path Build Web Apps with ASP.NET and would like some help to understand what is wrong with my code:

Link:

  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.

Here is my code:
Link.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace ResumeTemplater.Models
{
  // Additional Challenge
	public class Link : PageModel
	{
		public enum LinkType 
    { 
      Github,
      LinkedIn
    }
    public LinkType Type;
    public string URLPath { get; set; }

    public Link(LinkType type, string urlPath)
    {
      this.Type = type;
      this.URLPath = urlPath;
    }
	}
}

_Links.cs

<!-- _Links.cshtml -->
@model Link
<!-- Create partial below -->
@if (ViewData["Title"].ToString() == "Home")
{
  <a class="navbar-brand justify-content-start" 
  asp-host="www.linkedin.com" 
  asp-controller="@Model.URLPath">LinkedIn</a>
}
else if (ViewData["Title"].ToString() == "Projects")
{
  <a class="navbar-brand justify-content-start" 
  asp-host="www.github.com" 
  asp-controller="@Model.URLPath">Github</a>
}

Index.cshtml

@page

<!-- Index.cshtml -->
<!-- Add model directive below -->
@model IndexModel

@{
// Add ViewData Title below 
ViewData["Title"] = "Home";
}


<div class="jumbotron jumbotron-fluid jumbotron-container resume-jumbotron text-white">
	<div class="container-fluid jumbotron-content">
		<p class="text-center jumbotron-header mb-4">Hey there, I'm @Model.FullName<!-- Your name here -->!</p>
	</div>
</div>


<div class="container">
  	<div class="resume-content">
		<h4 class="general-header mb-3">Summary:</h4>
		<p class="general-content mb-3">I'm an enthusiastic software engineer with <!-- Years of experience -->@Model.YearsOfExperience+ years of experience participating in the complete lifecyclye of successfully launched applications. I am skilled in developing business plans, requirements specifications, user documentation, and architectural systems research. Strong written and verbal communications.</p>
	</div>

	<div class="resume-content">
		<h4 class="general-header mb-3">Languages:</h4>
		<ul class="list-group general-content">
      @foreach(var language in @Model.Languages){
      <li class="list-item" style="width: 18rem;">
        <!-- Language -->
        @language
      </li>
      }
		</ul>
	</div>

	<div class="resume-content">
		<h4 class="general-header mb-3">Contact</h4>
		<p class="general-content">
    <!-- Render partial for Link below -->
    <p>For more information regaridng my experience, please refer to my <partial name="_Links" model="@new Link(LinkType.LinkedIn, Model.LinkedInUsername)"></p>
		</p>
	</div>
</div>

Project.cshtml

@page
<!-- Projects.cshtml -->

<!-- Add model directive below -->
@model ProjectsModel

@{
  // Add ViewData Title below
  ViewData["Title"] = "Projects";
}

<div class="jumbotron jumbotron-fluid jumbotron-container text-white project-jumbotron">
	<div class="container-fluid jumbotron-content">
		<p class="text-center mb-4 jumbotron-header">Projects</p>
	</div>
</div>

<div class="container">
    @foreach(var project in Model.Projects)
    {
      if(project.Year > 2017){
      <div class="project-container">
        <h4 class="project-title general-header">
          <!--  Project Title -->
          @project.Title
        </h4>
        <p class="project-year general-header">
          <!--  Project Year -->
          @project.Year
        </p>
        <p class="project-description general-content">
          <!--  Project Description -->
          @project.Description
        </p>
        <h5>Technologies</h5>
        <ul class="general-header">
        @foreach(string technology in @project.Technologies){
          <li>@technology</li>
        }
        </ul>
		</div>
      }
		
    }
  
  <br>
	<h4 class="general-header">Portfolio</h4>
	<p class="general-content">
    <!-- Render partial for Link below -->
    <p>For more information regaridng my projects, please refer to my <partial name="_Links" for="@Model.GitHubUsername"></p>
	</p>
	<br>
</div>

Now the problem is, everytime I run my code, it throws an error about the name “LinkType” don’t exist. I’ve been racking my brains non-stop and can’t seem to find an accurate answer. Hope someone can help me.

Hi,

Finally fixed this problem.
To anyone who reads this post, please see the solution below:
So the problem that was being encountered is that the “LinkType” doesn’t exist.
This is the code before:

<p>For more information regaridng my experience, please refer to my <partial name="_Links" model="@new Link(LinkType.LinkedIn, Model.LinkedInUsername)"></p>

So what should it have been is that you should also specify the class name on the enum value that you are passing to the Link class. So the solution would be like this:

<p>For more information regaridng my experience, please refer to my <partial name="_Links" model="@new Link(Link.LinkType.LinkedIn, Model.LinkedInUsername)"></p>

So I’ve come up with these solution since I was debugging and trying to see the problem. I run the program without putting any parameter inside the object so it looked like this:

<p>For more information regaridng my experience, please refer to my <partial name="_Links" model="@new Link()"></p>

When I run the program, it was obviously gonna fail but it throws an interesting error:
image

It says: There is no argument given that corresponds to the required formal parameter ‘type’ of ‘Link.Link(Link.LinkType, string)’

Notice the first parameter? Link.LinkType, so that’s got me thinking. I was expecting it to be type LinkType, but was surprised that it was Link.LinkType. So I tried calling the enum by Link.LinkType.LinkedIn, and it worked!