public Report GetReport(int telephoneNumber) { var calls = _repository.GetInfoList().Where(x => x.MyNumber == telephoneNumber || x.ObjectNumber == telephoneNumber).ToList(); var report = new Report(); foreach (var call in calls) { CallTypes callType; int number; if (call.MyNumber == telephoneNumber) { callType = CallTypes.OutgoingCall; number = call.ObjectNumber; } else { callType = CallTypes.IncomingCall; number = call.MyNumber; } var entry = new CallRecords(callType, number, call.BeginCall, new DateTime((call.EndCall - call.BeginCall).Ticks), call.Price); report.AddRecord(entry); } return(report); }
public void AddRecord(CallRecords callRecords) { _listRecords.Add(callRecords); }