public IEnumerable<Application> GetApplicationsWhereRequirementsMatchPropertyAndStatus(string propertyReference, string area, string beds, string price, PropertyCaselistStatus propertyCaselistStatus, DateTime? dateCreated) { var applications = _propertyCaselistRepository.GetApplicationsWhereRequirementsMatchProperty(area, beds, price, propertyReference, dateCreated).ToList(); if (applications.IsNull() || applications.IsEmpty()) return new List<Application>(); foreach (var application in applications) { application.GeneratePropertyCaselistStatus(_propertyCaselistStatusGenererator, propertyReference); } return applications.FilterByPropertyCaselistStatus(propertyCaselistStatus).OrderByDescending(a=>a.DateUpdated); }
public static object ParsePropertyCaselistStatus(PropertyCaselistStatus propertyCaselistStatus) { switch (propertyCaselistStatus) { case PropertyCaselistStatus.Unknown: return "Unknown"; case PropertyCaselistStatus.ApplicantComplete: return "Applicant Complete"; case PropertyCaselistStatus.GuarantorComplete: return "Guarantor Complete"; case PropertyCaselistStatus.Approved: return "Approved"; case PropertyCaselistStatus.NotInterested: return "Not Interested"; case PropertyCaselistStatus.InProgress: return "In Progress"; case PropertyCaselistStatus.Cancelled: return "Cancelled"; case PropertyCaselistStatus.ApprovedInProgressElsewhere: return "Approved In Progress Elsewhere"; case PropertyCaselistStatus.Interested: return "Interested"; case PropertyCaselistStatus.Viewing: return "Viewing"; case PropertyCaselistStatus.AwaitingViewing: return "Awaiting Viewing"; default: return string.Empty; } }
public static IEnumerable<Application> FilterByPropertyCaselistStatus(this IEnumerable<Application> applications, PropertyCaselistStatus propertyCaselistStatus) { return applications.Where(a => a.PropertyCaselistStatus == propertyCaselistStatus); }