4using Microsoft.EntityFrameworkCore;
29 .Include(a => a.Currency)
55 throw new InvalidOperationException($
"Unique name violation.");
61 await
_db.SaveChangesAsync();
75 throw new InvalidOperationException($
"Unique name violation.");
80 await
_db.SaveChangesAsync();
93 if (agreement ==
null)
94 throw new NullReferenceException($
"Agreement with id {id} doesn't exist.");
95 agreement.IsActive =
false;
109 if (agreement ==
null)
110 throw new NullReferenceException($
"Agreement with id {id} doesn't exist.");
111 agreement.IsActive =
true;
DbSet< Agreement > Agreements
DateTime? AgreementUpdated
DateTime? AgreementCreated
AgreementService class inserts and updates Agreement in the Database
async Task< Agreement > GetAgreementById(int id)
Read one Agreement with id from database
AgreementService(DataContext db)
async Task< Agreement > UpdateAgreement(Agreement agreement)
Updates changes on a Agreement in the database
async Task< Agreement > AddAgreement(Agreement agreement)
Adds a Agreement to the database
async Task< Agreement > DeactivateAgreement(int id)
Deactivates a Agreement by setting IsActive attribute to false
async Task< List< Agreement > > GetAllAgreements()
Read all Agreements from database
async Task< Agreement > ActivateAgreement(int id)
Activates a Agreement by setting IsActive attribute to true