As a developer, I'm going to set up my CandyController Class so that it can be connected to all other files.
AC
WHENTHENAND
Dev Notes
Add the following using statements:
[ ] using CandyApi.DataAccess
[ ] using CandyApi.Model
Create a constructor for our CandyController and give it a declared private field of _repository. Which basically asks to make a new instance of a CandyRepo so that it can be used in other methods.
namespace CandyApi.Controllers
{
[Route("api/candies")]
[ApiController]
public class CandyController : ControllerBase
{
CandyRepository _repository;
public CandyController(CandyRepository repository)
{
_repository = repository;
}
}
}
Developer Story
As a developer, I'm going to set up my CandyController Class so that it can be connected to all other files.
AC
WHEN THEN AND
Dev Notes
Add the following using statements:
Create a constructor for our CandyController and give it a declared private field of _repository. Which basically asks to make a new instance of a CandyRepo so that it can be used in other methods.