public CotacaoEntity Update(CotacaoEntity cotacao) { if (cotacao == null) { throw new ArgumentNullException($"{nameof(cotacao)} must not be null"); } try { _collection.ReplaceOne(cotacaoEntity => cotacaoEntity.Id == cotacao.Id, cotacao); return(cotacao); } catch (Exception ex) { throw new Exception($"{nameof(cotacao)} could not be saved {ex.Message}"); } }
public CotacaoEntity Create(CotacaoEntity entity) { if (entity == null) { throw new ArgumentNullException($"{nameof(Create)} entity must not be null"); } try { _collection.InsertOne(entity); return(entity); } catch (Exception ex) { throw new Exception($"{nameof(entity)} could not be saved {ex.Message}"); } }