public async Task Add(Foul item) { try { await _context.Fouls.InsertOneAsync(item); } catch (Exception ex) { throw new ApplicationException("An error occurred while attempting to insert Foul data: " + ex.Message); } }
public async Task <bool> Update(string id, Foul item) { try { ReplaceOneResult actionResult = await _context.Fouls.ReplaceOneAsync( n => n.Id.Equals(id), item, new UpdateOptions { IsUpsert = true }); return(actionResult.IsAcknowledged && actionResult.ModifiedCount > 0); } catch (Exception ex) { throw new ApplicationException("An error occurred while attempting to update Foul data: " + ex.Message); } }