/// <summary> /// Deletes a possession /// </summary> public bool DestroyPossession(Possession usrRequest) { Possession toBeDeleted = _DB.Possessions.Find(usrRequest.Id); if (toBeDeleted == null) { return(false); } if (toBeDeleted.Equals(usrRequest)) { var possessionsInDB = _DB.Possessions.Where(s => s.PartOf.Id == toBeDeleted.Id).ToList(); foreach (var thing in possessionsInDB) { thing.PartOf = null; } } _DB.SaveChanges(); return(_DB.SaveChanges() != 0); }
public void AreEqual() { Assert.IsTrue(p1.Equals(p2)); }