public async Task AddNewConsent(CustomerConsent consent) { try { await _dataContext.CustomerConsents.InsertOneAsync(consent); } catch (Exception ex) { throw ex; } }
public async Task <bool> UpdateConsent(string custId, CustomerConsent consent) { var filter = Builders <CustomerConsent> .Filter.Eq(x => x.customerId, custId); var update = Builders <CustomerConsent> .Update.PushEach <Consent>(x => x.consents, consent.consents); try { UpdateResult res = await _dataContext.CustomerConsents.UpdateOneAsync(filter, update); return(res.IsAcknowledged && res.MatchedCount > 0); } catch (Exception ex) { throw ex; } }
public void Put(string id, [FromBody] CustomerConsent consent) { var res = _customerConsentService.UpdateConsent(id, consent); }