Am getting this error in my contoller-
Inconsistent accessibility: parameter type 'CRUDApplication.Models.IEmployeeRepository' is less accessible than method 'CRUDApplication.Controllers.EmployeeController.EmployeeController(CRUDApplication.Models.IEmployeeRepository)' c:\users\Abhi\documents\visual studio 2013\Projects\CRUDApplication\CRUDApplication\Controllers\EmployeeController.cs
Here's my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CRUDApplication.Models;
using System.Data;
namespace CRUDApplication.Controllers
{
public class EmployeeController : Controller
{
//
// GET: /Employee/
private IEmployeeRepository _repository;
public EmployeeController()
: this(new EmployeeRepository())
{
}
public EmployeeController(IEmployeeRepository repository)
{
_repository = repository;
}
public ActionResult Index()
{
var employee = _repository.GetEmployee();
return View(employee);
}
public ActionResult Details(int id)
{
EmployeeModel model = _repository.GetEmployeeByID(id);
return View(model);
}
public ActionResult Create()
{
return View(new EmployeeModel());
}
[HttpPost]
public ActionResult Create(EmployeeModel employee)
{
try
{
if (ModelState.IsValid)
{
_repository.InsertEmployee(employee);
return RedirectToAction("Index");
}
}
catch (DataException)
{
ModelState.AddModelError("", "Problem in Data Saving");
}
return View(employee);
}
public ActionResult Edit(int id)
{
EmployeeModel model = _repository.GetEmployeeByID(id);
return View(model);
}
[HttpPost]
public ActionResult Edit(EmployeeModel employee)
{
try
{
if (ModelState.IsValid)
{
_repository.UpdateEmployee(employee);
return RedirectToAction("Index");
}
}
catch (DataException)
{
ModelState.AddModelError("", "Problem in Data Saving");
}
return View(employee);
}
public ActionResult Delete(int id, bool? saveChangesError)
{
if (saveChangesError.GetValueOrDefault())
{
ViewBag.ErrorMessage = "Problem in Deleting";
}
EmployeeModel employee = _repository.GetEmployeeByID(id);
return View(employee);
}
[HttpPost, ActionName("Delete")]
public ActionResult DeleteConfirmed(int id)
{
try
{
EmployeeModel user = _repository.GetEmployeeByID(id);
_repository.DeleteEmployee(id);
}
catch (DataException)
{
return RedirectToAction("Delete",
new System.Web.Routing.RouteValueDictionary {
{ "id", id },
{ "saveChangesError", true } });
}
return RedirectToAction("Index");
}
}
}
I tried many things but still gettng same error. How to resolve it and what does that error mean.