Skip to content

Instantly share code, notes, and snippets.

@gashupl
Created May 27, 2019 18:02
Show Gist options
  • Save gashupl/b433a87eaef6d50960491a03d25685be to your computer and use it in GitHub Desktop.
Save gashupl/b433a87eaef6d50960491a03d25685be to your computer and use it in GitHub Desktop.
public interface IOpportunityRepository : IRepository<Opportunity>
{
List<Opportunity> GetByAccountId(Guid id);
}
public class OpportunityRepository : RepositoryBase<Opportunity>, IOpportunityRepository
{
public OpportunityRepository(IOrganizationService service) : base(service)
{
}
public List<Opportunity> GetByAccountId(Guid id)
{
var query = this.ServiceContext.OpportunitySet
.Where(o => o.CustomerId != null && o.CustomerId.Id == id);
return query.ToList<Opportunity>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment