Created
May 27, 2019 17:55
-
-
Save gashupl/0ebb655f8905c7249b527cb3d8d905e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class OpportunityRepository : IOpportunityRepository | |
| { | |
| protected Dyn365ServiceContext serviceContext; | |
| public OpportunityRepository(IOrganizationService service) | |
| { | |
| this.serviceContext = new Dyn365ServiceContext(service); | |
| } | |
| public Opportunity GetById(Guid id) | |
| { | |
| return this.serviceContext.OpportunitySet.FirstOrDefault(o => o.Id == id); | |
| } | |
| public void Create(Opportunity opportunity) | |
| { | |
| this.serviceContext.AddObject(opportunity); | |
| } | |
| public void SaveChanges() | |
| { | |
| this.serviceContext.SaveChanges(); | |
| } | |
| public void Dispose() | |
| { | |
| this.serviceContext.Dispose(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment