public void DeleteLongestCall() { ulong longestCallDuration = 0; Call longestCall = new Call(); foreach (var item in this.CallHistory) { if (item.Duration >= longestCallDuration) { longestCall = item; } } this.DeleteCallFromHistory(longestCall); }
public virtual void AddCallToHistory(string date, string time, string dialedPhone, ulong duration) { Call call = new Call(date, time, dialedPhone, duration); callHistory.Add(call); }
public bool DeleteCallFromHistory(Call call) { for (int i = 0; i < callHistory.Count; i++) { if (callHistory[i].Date == call.Date && callHistory[i].Time == call.Time && callHistory[i].DialedPhone == call.DialedPhone && callHistory[i].Duration == call.Duration) { callHistory.RemoveAt(i); return true; } } return false; }
public void AddCall(Call call) { CallHistory.Add(call); }