public async Task AddAddress(Address_OG address) { try { await _context.Addresses.InsertOneAsync(address); } catch (Exception ex) { throw ex; } }
public async Task <bool> DeleteAddress(Address_OG address) { try { DeleteResult actionResult = await _context.Addresses .DeleteOneAsync(n => n.Id.Equals(address.Id)); return(actionResult.IsAcknowledged && actionResult.DeletedCount > 0); } catch (Exception ex) { throw ex; } }
public async Task <bool> UpdateAddress(Address_OG address) { try { ReplaceOneResult actionResult = await _context.Addresses .ReplaceOneAsync(n => n.Id.Equals(address.Id) , address , new UpdateOptions { IsUpsert = true }); return(actionResult.IsAcknowledged && actionResult.ModifiedCount > 0); } catch (Exception ex) { throw ex; } }