Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created December 1, 2015 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/c9adc17279089057fea0 to your computer and use it in GitHub Desktop.
Save justinyoo/c9adc17279089057fea0 to your computer and use it in GitHub Desktop.
CRM 2015 Filtering Sample
[RoutePrefix("accounts")]
public class OrganisationController : ApiController
{
private readonly IOrganisationServiceContext _context;
public OrganisationController(IOrganisationServiceContext context)
{
this._context = context;
}
[Route("")]
public AccountModelCollection GetAccounts()
{
var accounts = this._context
.AccountSet
.Select(p => new AccountModel()
{
AccountNumber = p.AccountNumber,
Email = p.EMailAddress1
})
.ToList();
var collection = new AccountModelCollection(accounts);
return collection;
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment