Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My project can not see the namespace (asp.net mvc)? The Infrastructure word is underlined in the first line where it is written: using Chegg.Infrastructure; Also

My project can not see the namespace (asp.net mvc)?

  1. The Infrastructure word is underlined in the first line where it is written: using Chegg.Infrastructure;
  2. Also the IStaffRepository is underlined in the next two lines: private readonly IStaffRepository _staffRepository; public HomeController(IStaffRepository staffRepository)
using Chegg.Infrastructure; using Microsoft.AspNetCore.Mvc; namespace Chegg.UI.Controllers { public class HomeController : Controller { private readonly IStaffRepository _staffRepository; public HomeController(IStaffRepository staffRepository) { _staffRepository = staffRepository; } public IActionResult Index() { return View(); } [HttpGet] public IActionResult GetAllStaff() { var staff = _staffRepository.AllStaff(); return Json(staff); } [HttpGet] public IActionResult GetStaffDetails(int id) { var staff = _staffRepository.Get(id); return Json(staff); } } }

My StaffRepository looks this way:

namespace Chegg.Infrastructure; public interface IStaffRepository { Staff Get(int id); } public class StaffRepository : IStaffRepository { public Staff Get(int id) { return AllStaff().First(x => x.Id == id); } private IEnumerable AllStaff() { return new Staff[] { new Staff() { Id = 101, FullName = "Bon Jovi", Email = "bonjovi@singer.com", JobTitle = "Singer", Likes = new [] {"Sing", "Play"} }, new Staff() { Id = 182, FullName = "Ed Sheeran", Email = "edsheeran@singer.com", JobTitle = "Great Singer" }, new Staff() { Id = 100, FullName = "Adele", Email = "adele@singer.com", Likes = new [] {"sing","cakes"} }, }; } } public class Staff { public int Id { get; set; } public string FullName { get; set; } public string Email { get; set; } public string JobTitle { get; set; } public string[] Likes { get; set; }

Could you please help me in details? Maybe I need a file somewhere. May I get a step-by-step description with necessary code-changing, help. Thanks

==============================================================================================================

Main folder:

Chegg.Infrastructure folder

Chegg.UI folder

Chegg.sln Visual Studio Solution

etc.

In the Chegg.Infrastructure folder we can see:

bin folder

obj folder

Chegg.Infrastructure C# Project Source File

StaffRepository.cs C# Source File

etc.

In the Chegg.UI folder we can see the followings:

bin folder

Controllers folder

Models folder

obj folder

Properties folder

Views folder

www.root folder

etc.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions