我正在尝试创建一个web api应用程序但我的ajax调用有问题(使用angularjs)。我的get方法没问题但是当我想调用getbyid
方法时,它返回405(方法不允许)。
控制器:
public class BasicInformationRepository : IBasicInformationRepository
{
private readonly PezhContext _context;
public BasicInformationRepository(PezhContext context)
{
_context = context;
}
/// <summary>
/// takes all SUBSYSTEMS
/// </summary>
/// <returns>SUBSYSTEMS</returns>
public IEnumerable<BasicInformation> GetSubSystems()
{
return _context.BasicInformation.Where(a => a.BsiType == 1 && a.BsiParrentId == 0);
}
public IEnumerable<BasicInformation> GetSubMenuBySubSystem(int subSystemId)
{
return from bsi in _context.BasicInformation
where (bsi.BsiParrentId == subSystemId && bsi.BsiType == 2)
select bsi;
}
}