public T CheckOwnership(AuthenticatedRequestBase request, long id, Func <IQueryable <T>, IQueryable <T> > queryConfigurator) { return(queryConfigurator(ForUser(request.UserId)).FirstOrDefault(arg => arg.Id == id) ?? throw new UnauthorizedException($"You don't own {typeof(T).Name} with id {id}")); }
public T ForUser(AuthenticatedRequestBase request, long id) { return(ForUser(request).FirstOrDefault(arg => arg.Id == id)); }
public T CheckOwnership(AuthenticatedRequestBase request, long id) { return(ForUser(request, id) ?? throw new UnauthorizedException($"You don't own {typeof(T).Name} with id {id}")); }
public IQueryable <T> ForUser(AuthenticatedRequestBase request) { return(ForUser(request.UserId)); }