public static bool Equals(NetworkModel network1, NetworkModel network2) { if(network1 == null && network2 == null) { return true; } if(network1 == null ^ network2 == null) { return false; } return network1.Equals(network2); }
public static NetworkModel FromRepositoryType(Network network, DbSet<ComputerModel> computers, DbSet<UserModel> users) { var result = new NetworkModel { Address = network.Address, AttatchedComputer = network.AttatchedComputer == null ? null : computers.Find(network.AttatchedComputer.Id), //TODO: include devices?, Id = network.Id, LastPing = network.LastPing, Name = network.Name, Owner = users.Find(network.Owner.Id) }; return result; }
public bool Equals(NetworkModel that) { if (!base.Equals(that)) { return false; } if (!UserModel.Equals(this.Owner, that.Owner)) { return false; } return true; }