public void AddTestCrime(TestCrime crime) { if (crime == null) throw new ArgumentNullException(nameof(crime)); crime.Id = ObjectId.GenerateNewId().ToString(); _tcRepo.Add(crime); }
public void Update(TestCrime crime) { if (crime == null) throw new ArgumentNullException(nameof(crime)); if (string.IsNullOrEmpty(crime.Id)) throw new ArgumentException(nameof(crime.Id)); if (GetTestCrime(x => x.Id == crime.Id) == null) throw new NotFoundException(crime.Id); _tcRepo.Update(crime); }
public void Update(TestCrime crime) { _db.TestCrimes().FindOneAndReplace(x => x.Id == crime.Id, crime); }
public void Add(TestCrime crime) { _db.TestCrimes() .InsertOne(crime); }