1
請爲什麼我在庫中的錯誤ASP.NET MVC - 屬性或索引不能在這種情況下使用,因爲它缺少get訪問
錯誤18屬性或索引「BPP.CCSP .Admin.Infrastructure.STATES.COUNTRY_ID」不能在此上下文中,因爲它缺少get訪問
型號
public int STATE_ID { get; set; }
public Nullable<int> COUNTRY_ID { internal get; set; }
public string STATE_NAME { get; set; }
庫
public class AdminManager : IAdminManager
{
private readonly IRepository<STATES> _statesRepository;
public AdminManager(IRepository<PRB> prbsRepository, IRepository<OPTIONS> optionRepository, IRepository<COUNTRIES> countriesRepository, IRepository<STATES> statesRepository, IRepository<CITIES> citiesRepository)
{
_statesRepository = statesRepository;
}
public SelectList stateList()
{
var countryId = _statesRepository.FindAll().Where(c => c.COUNTRY_ID == 1);
var listStates = countryId.Select(c => new System.Web.Mvc.SelectListItem { Value = c.COUNTRY_ID.ToString(), Text = c.STATE_NAME }).OrderBy(c => c.Text).ToList();
var listCount = new SelectList(listStates, "value", "text");
return listCount;
}
}
請我該如何解決這個問題。