/// <summary> /// Update Exist Account. /// </summary> /// <param name="account">Exist Account.</param> /// <returns>Updated Account.</returns> public async Task <AccountEntityFull> Update(string id, AccountEntityBase account) { var entity = account.ToBsonDocument(); await Accounts.ReplaceOneAsync(new BsonDocument("_id", new ObjectId(id)), entity); return(BsonSerializer.Deserialize <AccountEntityFull>(entity)); }
/// <summary> /// Creates new Account. /// </summary> /// <param name="account">Account to set.</param> /// <returns>Setted Account with id.</returns> public async Task <AccountEntityFull> Create(AccountEntityBase account) { var entity = account.ToBsonDocument(); await Accounts.InsertOneAsync(entity); return(BsonSerializer.Deserialize <AccountEntityFull>(entity)); }