I have a base controller:
public abstract class EntityController<T> : BaseController
{
public EntityController(ILogService logService) : base(logService) { }
[HttpGet]
public abstract IEnumerable<T> Get();
[HttpGet]
public abstract T Get(int id);
[HttpPost]
[ValidateModel]
public abstract IHttpActionResult Create(T dto);
[HttpPut]
[ValidateModel]
public abstract IHttpActionResult Update(T dto);
[HttpDelete]
public abstract IHttpActionResult Delete(int id);
}
Everything works fine on most controllers inheriting this class. However, I have a few controllers where I would like to the 'hide' the Get() action.
Is it possible to do so at the action level, or should I throw a MethodNotFound exception?
Also, is it best practice for all of the above actions to return IHttpActionResult instead of IEnumerable and T ?